From 988cf543b5439e46d1d0b7911e9689c4d28f50fc Mon Sep 17 00:00:00 2001
From: librelois <elois@ifee.fr>
Date: Fri, 13 Oct 2017 16:32:59 +0200
Subject: [PATCH 01/18] [mod] add more typage in some tests

---
 app/lib/dto/ConfDTO.ts                 | 19 +++++++-------
 test/integration/documents-currency.ts | 36 ++++++++++++++------------
 test/integration/server-shutdown.ts    |  4 ++-
 test/integration/tools/toolbox.ts      |  8 +++---
 4 files changed, 37 insertions(+), 30 deletions(-)

diff --git a/app/lib/dto/ConfDTO.ts b/app/lib/dto/ConfDTO.ts
index 361eb49c9..7c0339f01 100644
--- a/app/lib/dto/ConfDTO.ts
+++ b/app/lib/dto/ConfDTO.ts
@@ -61,9 +61,9 @@ export interface NetworkConfDTO {
 
 export interface WS2PConfDTO {
   ws2p?: {
-    privateAccess: boolean
-    publicAccess: boolean
-    uuid: string
+    privateAccess?: boolean
+    publicAccess?: boolean
+    uuid?: string
     upnp?: boolean
     remotehost?: string|null
     remoteport?: number|null
@@ -135,9 +135,9 @@ export class ConfDTO implements CurrencyConfDTO, KeypairConfDTO, NetworkConfDTO,
     public memory: boolean,
     public nobma: boolean,
     public ws2p?: {
-      privateAccess: boolean
-      publicAccess: boolean
-      uuid: string
+      privateAccess?: boolean
+      publicAccess?: boolean
+      uuid?: string
       upnp?: boolean
       remotehost?: string|null
       remoteport?: number|null
@@ -156,7 +156,8 @@ export class ConfDTO implements CurrencyConfDTO, KeypairConfDTO, NetworkConfDTO,
   }
 
   static defaultConf() {
-    return {
+    return new ConfDTO("", "", [], [], 0, 3600 * 1000, constants.CONTRACT.DEFAULT.C, 1, 1, 0, 0, constants.CONTRACT.DEFAULT.C, constants.CONTRACT.DEFAULT.DT, constants.CONTRACT.DEFAULT.DT_REEVAL, 0, constants.CONTRACT.DEFAULT.UD0, 0, 0, constants.CONTRACT.DEFAULT.STEPMAX, constants.CONTRACT.DEFAULT.SIGPERIOD, 0, constants.CONTRACT.DEFAULT.SIGVALIDITY, constants.CONTRACT.DEFAULT.MSVALIDITY, constants.CONTRACT.DEFAULT.SIGQTY, constants.CONTRACT.DEFAULT.SIGSTOCK, constants.CONTRACT.DEFAULT.X_PERCENT, constants.CONTRACT.DEFAULT.PERCENTROT, constants.CONTRACT.DEFAULT.POWDELAY, constants.CONTRACT.DEFAULT.AVGGENTIME, constants.CONTRACT.DEFAULT.MEDIANTIMEBLOCKS, false, 3000, false, constants.BRANCHES.DEFAULT_WINDOW_SIZE, constants.CONTRACT.DEFAULT_IDTYWINDOW, constants.CONTRACT.DEFAULT.MSWINDOW, constants.CONTRACT.DEFAULT.SIGWINDOW, 0, { pub:'', sec:'' }, null, "", "", 0, "", "", "", 0, "", "", null, false, "", true, true)
+    /*return {
       "currency": null,
       "endpoints": [],
       "rmEndpoints": [],
@@ -182,10 +183,10 @@ export class ConfDTO implements CurrencyConfDTO, KeypairConfDTO, NetworkConfDTO,
       "isolate": false,
       "forksize": constants.BRANCHES.DEFAULT_WINDOW_SIZE,
       "switchOnHeadAdvance": CommonConstants.SWITCH_ON_BRANCH_AHEAD_BY_X_BLOCKS
-    };
+    };*/
   }
 
-  static complete(conf:any) {
+  static complete(conf:ConfDTO) {
     return _(ConfDTO.defaultConf()).extend(conf);
   }
 }
\ No newline at end of file
diff --git a/test/integration/documents-currency.ts b/test/integration/documents-currency.ts
index e18173af5..370b96ab9 100644
--- a/test/integration/documents-currency.ts
+++ b/test/integration/documents-currency.ts
@@ -1,30 +1,34 @@
-import {NewTestingServer} from "./tools/toolbox"
+import { NewTestingServer, TestingServer } from './tools/toolbox';
+import { unlock } from '../../app/lib/common-libs/txunlock';
+import { ConfDTO, CurrencyConfDTO } from '../../app/lib/dto/ConfDTO';
+import { Server } from '../../server';
 
 const co        = require('co');
 const should    = require('should');
 const user      = require('./tools/user');
 const commit    = require('./tools/commit');
 
-let s1:any, s2:any, cat1:any, tac1:any, toc2:any, tic2:any;
+let s1:TestingServer, s2:TestingServer, s1Conf:ConfDTO, s2Conf:ConfDTO, cat1:any, tac1:any, toc2:any, tic2:any;
 
 describe("Document pool currency", function() {
 
   before(() => co(function*() {
 
-    s1 = NewTestingServer({
-      currency: 'currency_one',
-      pair: {
-        pub: 'HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd',
-        sec: '51w4fEShBk1jCMauWu4mLpmDVfHksKmWcygpxriqCEZizbtERA6de4STKRkQBpxmMUwsKXRjSzuQ8ECwmqN1u2DP'
-      }
-    });
-    s2 = NewTestingServer({
-      currency: 'currency_two',
-      pair: {
-        pub: 'DKpQPUL4ckzXYdnDRvCRKAm1gNvSdmAXnTrJZ7LvM5Qo',
-        sec: '64EYRvdPpTfLGGmaX5nijLXRqWXaVz8r1Z1GtaahXwVSJGQRn7tqkxLb288zwSYzELMEG5ZhXSBYSxsTsz1m9y8F'
-      }
-    });
+    s1Conf = ConfDTO.defaultConf();
+    s1Conf.currency = 'currency_one'
+    s1Conf.pair = {
+      pub: 'HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd',
+      sec: '51w4fEShBk1jCMauWu4mLpmDVfHksKmWcygpxriqCEZizbtERA6de4STKRkQBpxmMUwsKXRjSzuQ8ECwmqN1u2DP'
+    }
+    s1 = NewTestingServer(s1Conf)
+    
+    s2Conf = ConfDTO.defaultConf();
+    s2Conf.currency = 'currency_one'
+    s2Conf.pair = {
+      pub: 'HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd',
+      sec: '51w4fEShBk1jCMauWu4mLpmDVfHksKmWcygpxriqCEZizbtERA6de4STKRkQBpxmMUwsKXRjSzuQ8ECwmqN1u2DP'
+    }
+    s2 = NewTestingServer(s2Conf);
 
     cat1 = user('cat', { pub: 'HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd', sec: '51w4fEShBk1jCMauWu4mLpmDVfHksKmWcygpxriqCEZizbtERA6de4STKRkQBpxmMUwsKXRjSzuQ8ECwmqN1u2DP'}, { server: s1 });
     tac1 = user('tac', { pub: '2LvDg21dVXvetTD9GdkPLURavLYEqP3whauvPWX4c2qc', sec: '2HuRLWgKgED1bVio1tdpeXrf7zuUszv1yPHDsDj7kcMC4rVSN9RC58ogjtKNfTbH1eFz7rn38U1PywNs3m6Q7UxE'}, { server: s1 });
diff --git a/test/integration/server-shutdown.ts b/test/integration/server-shutdown.ts
index 854e20eae..48af21914 100644
--- a/test/integration/server-shutdown.ts
+++ b/test/integration/server-shutdown.ts
@@ -1,3 +1,5 @@
+import { ConfDTO } from '../../app/lib/dto/ConfDTO';
+import { setTimeout } from 'timers';
 import {NewTestingServer} from "./tools/toolbox"
 
 const should = require('should')
@@ -6,7 +8,7 @@ const querablep = require('querablep')
 describe("Server shutdown", () => {
 
   it('should not interrupt a task in the documents FIFO', async () => {
-    const s1 = NewTestingServer({})
+    const s1 = NewTestingServer(ConfDTO.defaultConf())
 
     const fifo = s1._server.getDocumentsFIFO()
     const ops:any[] = []
diff --git a/test/integration/tools/toolbox.ts b/test/integration/tools/toolbox.ts
index fcf1e9670..7b68c60aa 100644
--- a/test/integration/tools/toolbox.ts
+++ b/test/integration/tools/toolbox.ts
@@ -218,11 +218,11 @@ export const fakeSyncServer = async (readBlocksMethod:any, readParticularBlockMe
  * Creates a new memory duniter server for Unit Test purposes.
  * @param conf
  */
-export const server = (conf:any) => NewTestingServer(conf)
-export const simpleTestingServer = (conf:any) => NewTestingServer(conf)
+export const server = (conf:ConfDTO) => NewTestingServer(conf)
+export const simpleTestingServer = (conf:ConfDTO) => NewTestingServer(conf)
 
-export const NewTestingServer = (conf:any) => {
-  const host = conf.host || HOST
+export const NewTestingServer = (conf:ConfDTO) => {
+  const host = conf.remotehost || HOST
   const port = conf.port || PORT++
   const commonConf = {
     nobma: false,
-- 
GitLab


From cb1b2abe00dfca87ffdd678e0044867491cc7f0f Mon Sep 17 00:00:00 2001
From: librelois <elois@ifee.fr>
Date: Fri, 13 Oct 2017 20:55:06 +0200
Subject: [PATCH 02/18] [mod] rename prover/Constants -> ProverConstants

---
 app/modules/prover/index.ts           | 10 +++++-----
 app/modules/prover/lib/blockProver.ts |  4 ++--
 app/modules/prover/lib/constants.ts   |  2 +-
 app/modules/prover/lib/engine.ts      |  4 ++--
 app/modules/prover/lib/powCluster.ts  |  4 ++--
 app/modules/prover/lib/proof.ts       | 10 +++++-----
 app/modules/ws2p/lib/WS2PCluster.ts   |  4 ++--
 7 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/app/modules/prover/index.ts b/app/modules/prover/index.ts
index 7bdd83464..a6016eaf7 100644
--- a/app/modules/prover/index.ts
+++ b/app/modules/prover/index.ts
@@ -1,6 +1,6 @@
 import {ConfDTO} from "../../lib/dto/ConfDTO"
 import {BlockGenerator, BlockGeneratorWhichProves} from "./lib/blockGenerator"
-import {Constants} from "./lib/constants"
+import {ProverConstants} from "./lib/constants"
 import {BlockProver} from "./lib/blockProver"
 import {Prover} from "./lib/prover"
 import {Contacter} from "../crawler/lib/contacter"
@@ -19,13 +19,13 @@ export const ProverDependency = {
     config: {
       onLoading: async (conf:ConfDTO) => {
         if (conf.cpu === null || conf.cpu === undefined) {
-          conf.cpu = Constants.DEFAULT_CPU;
+          conf.cpu = ProverConstants.DEFAULT_CPU;
         }
         if (conf.prefix === null || conf.prefix === undefined) {
-          conf.prefix = Constants.DEFAULT_PEER_ID;
+          conf.prefix = ProverConstants.DEFAULT_PEER_ID;
         }
-        conf.powSecurityRetryDelay = Constants.POW_SECURITY_RETRY_DELAY;
-        conf.powMaxHandicap = Constants.POW_MAXIMUM_ACCEPTABLE_HANDICAP;
+        conf.powSecurityRetryDelay = ProverConstants.POW_SECURITY_RETRY_DELAY;
+        conf.powMaxHandicap = ProverConstants.POW_MAXIMUM_ACCEPTABLE_HANDICAP;
       },
       beforeSave: async (conf:ConfDTO) => {
         delete conf.powSecurityRetryDelay;
diff --git a/app/modules/prover/lib/blockProver.ts b/app/modules/prover/lib/blockProver.ts
index 1c68518f7..9cd215d98 100644
--- a/app/modules/prover/lib/blockProver.ts
+++ b/app/modules/prover/lib/blockProver.ts
@@ -1,4 +1,4 @@
-import {Constants} from "./constants"
+import {ProverConstants} from "./constants"
 import {Server} from "../../../../server"
 import {PowEngine} from "./engine"
 import {DBBlock} from "../../../lib/db/DBBlock"
@@ -165,7 +165,7 @@ export class BlockProver {
       // Start
       powFarm.setOnAlmostPoW((pow:any, matches:any, aBlock:any, found:boolean) => {
         this.powEvent(found, pow);
-        if (matches && matches[1].length >= Constants.MINIMAL_ZEROS_TO_SHOW_IN_LOGS) {
+        if (matches && matches[1].length >= ProverConstants.MINIMAL_ZEROS_TO_SHOW_IN_LOGS) {
           this.logger.info('Matched %s zeros %s with Nonce = %s for block#%s by %s', matches[1].length, pow, aBlock.nonce, aBlock.number, aBlock.issuer.slice(0,6));
         }
       });
diff --git a/app/modules/prover/lib/constants.ts b/app/modules/prover/lib/constants.ts
index 0602e7de8..0a454d38f 100644
--- a/app/modules/prover/lib/constants.ts
+++ b/app/modules/prover/lib/constants.ts
@@ -1,4 +1,4 @@
-export const Constants = {
+export const ProverConstants = {
 
   CORES_MAXIMUM_USE_IN_PARALLEL: 8,
 
diff --git a/app/modules/prover/lib/engine.ts b/app/modules/prover/lib/engine.ts
index 12d2751d6..2be351a91 100644
--- a/app/modules/prover/lib/engine.ts
+++ b/app/modules/prover/lib/engine.ts
@@ -1,4 +1,4 @@
-import {Constants} from "./constants"
+import {ProverConstants} from "./constants"
 import {Master as PowCluster} from "./powCluster"
 import {ConfDTO} from "../../../lib/dto/ConfDTO"
 
@@ -20,7 +20,7 @@ export class PowEngine {
   constructor(private conf:ConfDTO, logger:any) {
 
     // We use as much cores as available, but not more than CORES_MAXIMUM_USE_IN_PARALLEL
-    this.nbWorkers = (conf && conf.nbCores) || Math.min(Constants.CORES_MAXIMUM_USE_IN_PARALLEL, require('os').cpus().length)
+    this.nbWorkers = (conf && conf.nbCores) || Math.min(ProverConstants.CORES_MAXIMUM_USE_IN_PARALLEL, require('os').cpus().length)
     this.cluster = new PowCluster(this.nbWorkers, logger)
     this.id = this.cluster.clusterId
   }
diff --git a/app/modules/prover/lib/powCluster.ts b/app/modules/prover/lib/powCluster.ts
index 1e1a6ad3d..4d4820777 100644
--- a/app/modules/prover/lib/powCluster.ts
+++ b/app/modules/prover/lib/powCluster.ts
@@ -1,5 +1,5 @@
 import {ConfDTO} from "../../../lib/dto/ConfDTO"
-import {Constants} from "./constants"
+import {ProverConstants} from "./constants"
 
 const _ = require('underscore')
 const nuuid = require('node-uuid');
@@ -84,7 +84,7 @@ export class Master {
         })(),
 
         // Each worker has his own chunk of possible nonces
-        nonceBeginning: this.nbCores === 1 ? 0 : (index + 1) * Constants.NONCE_RANGE
+        nonceBeginning: this.nbCores === 1 ? 0 : (index + 1) * ProverConstants.NONCE_RANGE
       }
       return this.slavesMap[worker.id]
     })
diff --git a/app/modules/prover/lib/proof.ts b/app/modules/prover/lib/proof.ts
index cc60a584f..9b15c0be5 100644
--- a/app/modules/prover/lib/proof.ts
+++ b/app/modules/prover/lib/proof.ts
@@ -2,7 +2,7 @@ import {LOCAL_RULES_HELPERS} from "../../../lib/rules/local_rules"
 import {hashf} from "../../../lib/common"
 import {DBBlock} from "../../../lib/db/DBBlock"
 import {ConfDTO} from "../../../lib/dto/ConfDTO"
-import {Constants} from "./constants"
+import {ProverConstants} from "./constants"
 import {KeyGen} from "../../../lib/common-libs/crypto/keyring"
 import {dos2unix} from "../../../lib/common-libs/dos2unix"
 import {rawer} from "../../../lib/common-libs/index"
@@ -84,10 +84,10 @@ function beginNewProofOfWork(stuff:any) {
     const nbZeros = stuff.zeros;
     const pair = stuff.pair;
     const forcedTime = stuff.forcedTime;
-    currentCPU = conf.cpu || Constants.DEFAULT_CPU;
+    currentCPU = conf.cpu || ProverConstants.DEFAULT_CPU;
     prefix = parseInt(conf.prefix || prefix)
-    if (prefix && prefix < Constants.NONCE_RANGE) {
-      prefix *= 100 * Constants.NONCE_RANGE
+    if (prefix && prefix < ProverConstants.NONCE_RANGE) {
+      prefix *= 100 * ProverConstants.NONCE_RANGE
     }
     const highMark = stuff.highMark;
     const turnDuration = stuff.turnDuration || TURN_DURATION_IN_MILLISEC
@@ -184,7 +184,7 @@ function beginNewProofOfWork(stuff:any) {
             if (charOK) {
               found = !!(pow[nbZeros].match(new RegExp('[0-' + highMark + ']')))
             }
-            if (!found && nbZeros > 0 && j - 1 >= Constants.POW_MINIMAL_TO_SHOW) {
+            if (!found && nbZeros > 0 && j - 1 >= ProverConstants.POW_MINIMAL_TO_SHOW) {
               pSend({ pow: { pow: pow, block: block, nbZeros: nbZeros }});
             }
 
diff --git a/app/modules/ws2p/lib/WS2PCluster.ts b/app/modules/ws2p/lib/WS2PCluster.ts
index 4c991070b..766e83eee 100644
--- a/app/modules/ws2p/lib/WS2PCluster.ts
+++ b/app/modules/ws2p/lib/WS2PCluster.ts
@@ -15,7 +15,7 @@ import {WS2PServerMessageHandler} from "./interface/WS2PServerMessageHandler"
 import {WS2PMessageHandler} from "./impl/WS2PMessageHandler"
 import { CommonConstants } from "../../../lib/common-libs/constants";
 import { Package } from "../../../lib/common/package";
-import { Constants } from "../../prover/lib/constants";
+import { ProverConstants } from "../../prover/lib/constants";
 
 const es = require('event-stream')
 const nuuid = require('node-uuid')
@@ -426,7 +426,7 @@ export class WS2PCluster {
     const software = 'duniter'
     const softVersion = Package.getInstance().version
     const ws2pId = (this.server.conf.ws2p && this.server.conf.ws2p.uuid) || '00000000'
-    const prefix = this.server.conf.prefix || Constants.DEFAULT_PEER_ID
+    const prefix = this.server.conf.prefix || ProverConstants.DEFAULT_PEER_ID
     const message = `WS2P:HEAD:1:${pub}:${number}-${hash}:${ws2pId}:${software}:${softVersion}:${prefix}`
     const sig = key.signSync(message)
     return { sig, message, pub }
-- 
GitLab


From a1c224907e9c8f0b929bef59aff032df53990840 Mon Sep 17 00:00:00 2001
From: librelois <elois@ifee.fr>
Date: Fri, 13 Oct 2017 20:55:48 +0200
Subject: [PATCH 03/18] [fix] ConfDTO typing errors

---
 app/lib/constants.ts                   |  7 ++++++-
 app/lib/dto/ConfDTO.ts                 |  7 ++++---
 test/integration/documents-currency.ts | 29 +++++++++++++-------------
 test/integration/tools/toolbox.ts      |  2 +-
 4 files changed, 25 insertions(+), 20 deletions(-)

diff --git a/app/lib/constants.ts b/app/lib/constants.ts
index cac2f7a07..3641d9352 100644
--- a/app/lib/constants.ts
+++ b/app/lib/constants.ts
@@ -1,6 +1,7 @@
 "use strict";
 import {CommonConstants} from "./common-libs/constants"
 import {OtherConstants} from "./other_constants"
+import { ProverConstants } from '../modules/prover/lib/constants';
 
 const UDID2        = "udid2;c;([A-Z-]*);([A-Z-]*);(\\d{4}-\\d{2}-\\d{2});(e\\+\\d{2}\\.\\d{2}(\\+|-)\\d{3}\\.\\d{2});(\\d+)(;?)";
 const PUBKEY       = CommonConstants.FORMATS.PUBKEY
@@ -113,7 +114,11 @@ module.exports = {
   },
   PROOF_OF_WORK: {
     EVALUATION: 1000,
-    UPPER_BOUND: CommonConstants.PROOF_OF_WORK.UPPER_BOUND.slice()
+    UPPER_BOUND: CommonConstants.PROOF_OF_WORK.UPPER_BOUND.slice(),
+    DEFAULT: {
+      CPU: ProverConstants.DEFAULT_CPU,
+      PREFIX: ProverConstants.DEFAULT_PEER_ID
+    }
   },
 
   DEFAULT_CURRENCY_NAME: "no_currency",
diff --git a/app/lib/dto/ConfDTO.ts b/app/lib/dto/ConfDTO.ts
index 7c0339f01..3c14e4809 100644
--- a/app/lib/dto/ConfDTO.ts
+++ b/app/lib/dto/ConfDTO.ts
@@ -126,6 +126,7 @@ export class ConfDTO implements CurrencyConfDTO, KeypairConfDTO, NetworkConfDTO,
     public remotehost: string|null,
     public remoteipv4: string|null,
     public remoteipv6: string|null,
+    public host: string,
     public port: number,
     public ipv4: string,
     public ipv6: string,
@@ -152,11 +153,11 @@ export class ConfDTO implements CurrencyConfDTO, KeypairConfDTO, NetworkConfDTO,
 ) {}
 
   static mock() {
-    return new ConfDTO("", "", [], [], 0, 0, 0.6, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, false, 0, false, 0, 0, 0, 0, 0, { pub:'', sec:'' }, null, "", "", 0, "", "", "", 0, "", "", null, false, "", true, true)
+    return new ConfDTO("", "", [], [], 0, 3600 * 1000, constants.PROOF_OF_WORK.DEFAULT.CPU, 1, constants.PROOF_OF_WORK.DEFAULT.PREFIX, 0, 0, constants.CONTRACT.DEFAULT.C, constants.CONTRACT.DEFAULT.DT, constants.CONTRACT.DEFAULT.DT_REEVAL, 0, constants.CONTRACT.DEFAULT.UD0, 0, 0, constants.CONTRACT.DEFAULT.STEPMAX, constants.CONTRACT.DEFAULT.SIGPERIOD, 0, constants.CONTRACT.DEFAULT.SIGVALIDITY, constants.CONTRACT.DEFAULT.MSVALIDITY, constants.CONTRACT.DEFAULT.SIGQTY, constants.CONTRACT.DEFAULT.SIGSTOCK, constants.CONTRACT.DEFAULT.X_PERCENT, constants.CONTRACT.DEFAULT.PERCENTROT, constants.CONTRACT.DEFAULT.POWDELAY, constants.CONTRACT.DEFAULT.AVGGENTIME, constants.CONTRACT.DEFAULT.MEDIANTIMEBLOCKS, false, 3000, false, constants.BRANCHES.DEFAULT_WINDOW_SIZE, constants.CONTRACT.DEFAULT.IDTYWINDOW, constants.CONTRACT.DEFAULT.MSWINDOW, constants.CONTRACT.DEFAULT.SIGWINDOW, 0, { pub:'', sec:'' }, null, "", "", 0, "", "", "", "", 0, "", "", null, false, "", true, true)
   }
 
   static defaultConf() {
-    return new ConfDTO("", "", [], [], 0, 3600 * 1000, constants.CONTRACT.DEFAULT.C, 1, 1, 0, 0, constants.CONTRACT.DEFAULT.C, constants.CONTRACT.DEFAULT.DT, constants.CONTRACT.DEFAULT.DT_REEVAL, 0, constants.CONTRACT.DEFAULT.UD0, 0, 0, constants.CONTRACT.DEFAULT.STEPMAX, constants.CONTRACT.DEFAULT.SIGPERIOD, 0, constants.CONTRACT.DEFAULT.SIGVALIDITY, constants.CONTRACT.DEFAULT.MSVALIDITY, constants.CONTRACT.DEFAULT.SIGQTY, constants.CONTRACT.DEFAULT.SIGSTOCK, constants.CONTRACT.DEFAULT.X_PERCENT, constants.CONTRACT.DEFAULT.PERCENTROT, constants.CONTRACT.DEFAULT.POWDELAY, constants.CONTRACT.DEFAULT.AVGGENTIME, constants.CONTRACT.DEFAULT.MEDIANTIMEBLOCKS, false, 3000, false, constants.BRANCHES.DEFAULT_WINDOW_SIZE, constants.CONTRACT.DEFAULT_IDTYWINDOW, constants.CONTRACT.DEFAULT.MSWINDOW, constants.CONTRACT.DEFAULT.SIGWINDOW, 0, { pub:'', sec:'' }, null, "", "", 0, "", "", "", 0, "", "", null, false, "", true, true)
+    return new ConfDTO("", "", [], [], 0, 3600 * 1000, constants.PROOF_OF_WORK.DEFAULT.CPU, 1, constants.PROOF_OF_WORK.DEFAULT.PREFIX, 0, 0, constants.CONTRACT.DEFAULT.C, constants.CONTRACT.DEFAULT.DT, constants.CONTRACT.DEFAULT.DT_REEVAL, 0, constants.CONTRACT.DEFAULT.UD0, 0, 0, constants.CONTRACT.DEFAULT.STEPMAX, constants.CONTRACT.DEFAULT.SIGPERIOD, 0, constants.CONTRACT.DEFAULT.SIGVALIDITY, constants.CONTRACT.DEFAULT.MSVALIDITY, constants.CONTRACT.DEFAULT.SIGQTY, constants.CONTRACT.DEFAULT.SIGSTOCK, constants.CONTRACT.DEFAULT.X_PERCENT, constants.CONTRACT.DEFAULT.PERCENTROT, constants.CONTRACT.DEFAULT.POWDELAY, constants.CONTRACT.DEFAULT.AVGGENTIME, constants.CONTRACT.DEFAULT.MEDIANTIMEBLOCKS, false, 3000, false, constants.BRANCHES.DEFAULT_WINDOW_SIZE, constants.CONTRACT.DEFAULT.IDTYWINDOW, constants.CONTRACT.DEFAULT.MSWINDOW, constants.CONTRACT.DEFAULT.SIGWINDOW, 0, { pub:'', sec:'' }, null, "", "", 0, "", "", "", "", 0, "", "", null, false, "", true, true)
     /*return {
       "currency": null,
       "endpoints": [],
@@ -186,7 +187,7 @@ export class ConfDTO implements CurrencyConfDTO, KeypairConfDTO, NetworkConfDTO,
     };*/
   }
 
-  static complete(conf:ConfDTO) {
+  static complete(conf:any) {
     return _(ConfDTO.defaultConf()).extend(conf);
   }
 }
\ No newline at end of file
diff --git a/test/integration/documents-currency.ts b/test/integration/documents-currency.ts
index 370b96ab9..36c5e767b 100644
--- a/test/integration/documents-currency.ts
+++ b/test/integration/documents-currency.ts
@@ -14,21 +14,20 @@ describe("Document pool currency", function() {
 
   before(() => co(function*() {
 
-    s1Conf = ConfDTO.defaultConf();
-    s1Conf.currency = 'currency_one'
-    s1Conf.pair = {
-      pub: 'HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd',
-      sec: '51w4fEShBk1jCMauWu4mLpmDVfHksKmWcygpxriqCEZizbtERA6de4STKRkQBpxmMUwsKXRjSzuQ8ECwmqN1u2DP'
-    }
-    s1 = NewTestingServer(s1Conf)
-    
-    s2Conf = ConfDTO.defaultConf();
-    s2Conf.currency = 'currency_one'
-    s2Conf.pair = {
-      pub: 'HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd',
-      sec: '51w4fEShBk1jCMauWu4mLpmDVfHksKmWcygpxriqCEZizbtERA6de4STKRkQBpxmMUwsKXRjSzuQ8ECwmqN1u2DP'
-    }
-    s2 = NewTestingServer(s2Conf);
+    s1 = NewTestingServer(ConfDTO.complete({
+      currency: 'currency_one',
+      pair: {
+        pub: 'HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd',
+        sec: '51w4fEShBk1jCMauWu4mLpmDVfHksKmWcygpxriqCEZizbtERA6de4STKRkQBpxmMUwsKXRjSzuQ8ECwmqN1u2DP'
+      }
+    }));
+    s2 = NewTestingServer(ConfDTO.complete({
+      currency: 'currency_two',
+      pair: {
+        pub: 'DKpQPUL4ckzXYdnDRvCRKAm1gNvSdmAXnTrJZ7LvM5Qo',
+        sec: '64EYRvdPpTfLGGmaX5nijLXRqWXaVz8r1Z1GtaahXwVSJGQRn7tqkxLb288zwSYzELMEG5ZhXSBYSxsTsz1m9y8F'
+      }
+    }));
 
     cat1 = user('cat', { pub: 'HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd', sec: '51w4fEShBk1jCMauWu4mLpmDVfHksKmWcygpxriqCEZizbtERA6de4STKRkQBpxmMUwsKXRjSzuQ8ECwmqN1u2DP'}, { server: s1 });
     tac1 = user('tac', { pub: '2LvDg21dVXvetTD9GdkPLURavLYEqP3whauvPWX4c2qc', sec: '2HuRLWgKgED1bVio1tdpeXrf7zuUszv1yPHDsDj7kcMC4rVSN9RC58ogjtKNfTbH1eFz7rn38U1PywNs3m6Q7UxE'}, { server: s1 });
diff --git a/test/integration/tools/toolbox.ts b/test/integration/tools/toolbox.ts
index 7b68c60aa..a9e1249a2 100644
--- a/test/integration/tools/toolbox.ts
+++ b/test/integration/tools/toolbox.ts
@@ -222,7 +222,7 @@ export const server = (conf:ConfDTO) => NewTestingServer(conf)
 export const simpleTestingServer = (conf:ConfDTO) => NewTestingServer(conf)
 
 export const NewTestingServer = (conf:ConfDTO) => {
-  const host = conf.remotehost || HOST
+  const host = conf.host || HOST
   const port = conf.port || PORT++
   const commonConf = {
     nobma: false,
-- 
GitLab


From ba478e8351e591866b73604f6fc2363a5428127d Mon Sep 17 00:00:00 2001
From: librelois <elois@ifee.fr>
Date: Fri, 13 Oct 2017 20:56:17 +0200
Subject: [PATCH 04/18] rename ProverConstants

---
 index.ts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/index.ts b/index.ts
index 3c6b04bc5..97b9f6816 100644
--- a/index.ts
+++ b/index.ts
@@ -7,7 +7,7 @@ import {KeypairDependency} from "./app/modules/keypair/index"
 import {CrawlerDependency} from "./app/modules/crawler/index"
 import {BmaDependency} from "./app/modules/bma/index"
 import {WS2PDependency} from "./app/modules/ws2p/index"
-import {Constants} from "./app/modules/prover/lib/constants"
+import {ProverConstants} from "./app/modules/prover/lib/constants"
 
 const path = require('path');
 const _ = require('underscore');
@@ -469,7 +469,7 @@ function commandLineConf(program:any, conf:any = {}) {
   if (cli.currency)                         conf.currency = cli.currency;
   if (cli.server.port)                      conf.port = cli.server.port;
   if (cli.cpu)                              conf.cpu = Math.max(0.01, Math.min(1.0, cli.cpu));
-  if (cli.prefix)                           conf.prefix = Math.max(Constants.MIN_PEER_ID, Math.min(Constants.MAX_PEER_ID, cli.prefix));
+  if (cli.prefix)                           conf.prefix = Math.max(ProverConstants.MIN_PEER_ID, Math.min(ProverConstants.MAX_PEER_ID, cli.prefix));
   if (cli.logs.http)                        conf.httplogs = true;
   if (cli.logs.nohttp)                      conf.httplogs = false;
   if (cli.db.mport)                         conf.mport = cli.db.mport;
-- 
GitLab


From 314c83fd900649d61b77b2e97cc00b9f0060d0fc Mon Sep 17 00:00:00 2001
From: librelois <elois@ifee.fr>
Date: Fri, 13 Oct 2017 22:01:14 +0200
Subject: [PATCH 05/18] [typage] create type sandboxDocument

---
 app/lib/dal/fileDAL.ts                 |  2 +-
 app/lib/dal/sqliteDAL/CertDAL.ts       |  4 ++--
 app/lib/dal/sqliteDAL/IdentityDAL.ts   |  4 ++--
 app/lib/dal/sqliteDAL/MembershipDAL.ts |  4 ++--
 app/lib/dal/sqliteDAL/SandBox.ts       | 10 +++++++---
 app/lib/dal/sqliteDAL/TxsDAL.ts        |  5 ++---
 app/service/IdentityService.ts         |  1 +
 app/service/MembershipService.ts       |  1 +
 app/service/TransactionsService.ts     |  2 +-
 9 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/app/lib/dal/fileDAL.ts b/app/lib/dal/fileDAL.ts
index 6281d83fb..43f4952c3 100644
--- a/app/lib/dal/fileDAL.ts
+++ b/app/lib/dal/fileDAL.ts
@@ -754,7 +754,7 @@ export class FileDAL {
   }
 
   saveTransaction(tx:DBTx) {
-    return this.txsDAL.addPending(TransactionDTO.fromJSONObject(tx))
+    return this.txsDAL.addPending(tx)
   }
 
   async getTransactionsHistory(pubkey:string) {
diff --git a/app/lib/dal/sqliteDAL/CertDAL.ts b/app/lib/dal/sqliteDAL/CertDAL.ts
index d854ef16b..0efb58f24 100644
--- a/app/lib/dal/sqliteDAL/CertDAL.ts
+++ b/app/lib/dal/sqliteDAL/CertDAL.ts
@@ -1,10 +1,10 @@
 import {SQLiteDriver} from "../drivers/SQLiteDriver"
 import {AbstractSQLite} from "./AbstractSQLite"
-import {SandBox} from "./SandBox"
+import { SandBox, sandboxDocument } from './SandBox';
 
 const constants = require('../../constants');
 
-export interface DBCert {
+export interface DBCert extends sandboxDocument {
   linked:boolean
   written:boolean
   written_block:null
diff --git a/app/lib/dal/sqliteDAL/IdentityDAL.ts b/app/lib/dal/sqliteDAL/IdentityDAL.ts
index c23f6be99..1445fb350 100644
--- a/app/lib/dal/sqliteDAL/IdentityDAL.ts
+++ b/app/lib/dal/sqliteDAL/IdentityDAL.ts
@@ -1,6 +1,6 @@
 import {AbstractSQLite} from "./AbstractSQLite"
 import {SQLiteDriver} from "../drivers/SQLiteDriver"
-import {SandBox} from "./SandBox"
+import { SandBox, sandboxDocument } from './SandBox';
 import {IdentityDTO} from "../../dto/IdentityDTO"
 import {Cloneable} from "../../dto/Cloneable";
 const constants = require('../../constants');
@@ -143,7 +143,7 @@ export class ExistingDBIdentity extends DBIdentity {
   }
 }
 
-export interface DBSandboxIdentity extends DBIdentity {
+export interface DBSandboxIdentity extends DBIdentity,sandboxDocument {
   certsCount: number
   ref_block: number
 }
diff --git a/app/lib/dal/sqliteDAL/MembershipDAL.ts b/app/lib/dal/sqliteDAL/MembershipDAL.ts
index 61ce346e9..41557cf89 100644
--- a/app/lib/dal/sqliteDAL/MembershipDAL.ts
+++ b/app/lib/dal/sqliteDAL/MembershipDAL.ts
@@ -1,10 +1,10 @@
 import {SQLiteDriver} from "../drivers/SQLiteDriver";
 import {AbstractSQLite} from "./AbstractSQLite";
-import {SandBox} from "./SandBox";
+import { SandBox, sandboxDocument } from './SandBox';
 const _ = require('underscore');
 const constants = require('../../constants');
 
-export interface DBMembership {
+export interface DBMembership extends sandboxDocument {
   membership: string
   issuer: string
   number: number
diff --git a/app/lib/dal/sqliteDAL/SandBox.ts b/app/lib/dal/sqliteDAL/SandBox.ts
index c84f9a87f..48d736dc8 100644
--- a/app/lib/dal/sqliteDAL/SandBox.ts
+++ b/app/lib/dal/sqliteDAL/SandBox.ts
@@ -1,4 +1,8 @@
-export class SandBox<T> {
+export interface sandboxDocument {
+  issuers: string[];
+}
+
+export class SandBox<T extends sandboxDocument> {
 
   maxSize:number
   
@@ -10,8 +14,8 @@ export class SandBox<T> {
     this.maxSize = maxSize || 10
   }
   
-  async acceptNewSandBoxEntry(element:any, pubkey:string) {
-    if (element.pubkey === pubkey) {
+  async acceptNewSandBoxEntry(element:T, pubkey:string) {
+    if (element.issuers.indexOf(pubkey) !== -1) {
       return true;
     }
     const elements = await this.findElements()
diff --git a/app/lib/dal/sqliteDAL/TxsDAL.ts b/app/lib/dal/sqliteDAL/TxsDAL.ts
index b6330cb93..204ae8277 100644
--- a/app/lib/dal/sqliteDAL/TxsDAL.ts
+++ b/app/lib/dal/sqliteDAL/TxsDAL.ts
@@ -169,12 +169,11 @@ export class TxsDAL extends AbstractSQLite<DBTx> {
     return this.saveEntity(dbTx)
   }
 
-  addPending(tx:TransactionDTO) {
-    const dbTx = DBTx.fromTransactionDTO(tx)
+  addPending(dbTx:DBTx) {
     dbTx.received = moment().unix()
     dbTx.written = false
     dbTx.removed = false
-    dbTx.hash = tx.getHash()
+    //dbTx.hash = tx.getHash()
     return this.saveEntity(dbTx)
   }
 
diff --git a/app/service/IdentityService.ts b/app/service/IdentityService.ts
index 81288451d..7dc412240 100644
--- a/app/service/IdentityService.ts
+++ b/app/service/IdentityService.ts
@@ -166,6 +166,7 @@ export class IdentityService extends FIFOService {
             };
           }
           const mCert:DBCert = {
+            issuers: [cert.from],
             from: cert.from,
             sig: cert.sig,
             block_number: cert.block_number,
diff --git a/app/service/MembershipService.ts b/app/service/MembershipService.ts
index fd27d3d24..5612493db 100644
--- a/app/service/MembershipService.ts
+++ b/app/service/MembershipService.ts
@@ -63,6 +63,7 @@ export class MembershipService extends FIFOService {
       }
       // Saves entry
       await this.dal.savePendingMembership({
+        issuers: [entry.issuer],
         membership: entry.membership,
         issuer: entry.issuer,
         number: entry.number,
diff --git a/app/service/TransactionsService.ts b/app/service/TransactionsService.ts
index ab144b243..e6ddf1263 100644
--- a/app/service/TransactionsService.ts
+++ b/app/service/TransactionsService.ts
@@ -46,7 +46,7 @@ export class TransactionService extends FIFOService {
         await GLOBAL_RULES_HELPERS.checkSingleTransaction(dto, nextBlockWithFakeTimeVariation, this.conf, this.dal, CHECK_PENDING_TRANSACTIONS);
         const server_pubkey = this.conf.pair && this.conf.pair.pub;
         if (!(await this.dal.txsDAL.sandbox.acceptNewSandBoxEntry({
-            pubkey: tx.issuers.indexOf(server_pubkey) !== -1 ? server_pubkey : '',
+            issuers: tx.issuers,
             output_base: tx.output_base,
             output_amount: tx.output_amount
           }, server_pubkey))) {
-- 
GitLab


From 88172f5357cd0d8d43f60a4878e6d5da6c4aa0eb Mon Sep 17 00:00:00 2001
From: librelois <elois@ifee.fr>
Date: Fri, 13 Oct 2017 22:06:42 +0200
Subject: [PATCH 06/18] [fix] ProverConstant incomplete renaming

---
 test/integration/branches_revert2.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/integration/branches_revert2.js b/test/integration/branches_revert2.js
index 9800c3ad7..4d5d38a3c 100644
--- a/test/integration/branches_revert2.js
+++ b/test/integration/branches_revert2.js
@@ -10,7 +10,7 @@ const httpTest  = require('./tools/http');
 const commit    = require('./tools/commit');
 const shutDownEngine  = require('./tools/shutDownEngine');
 
-require('../../app/modules/prover/lib/constants').Constants.CORES_MAXIMUM_USE_IN_PARALLEL = 1
+require('../../app/modules/prover/lib/constants').ProverConstants.CORES_MAXIMUM_USE_IN_PARALLEL = 1
 require('../../app/modules/bma').BmaDependency.duniter.methods.noLimit(); // Disables the HTTP limiter
 
 const expectJSON     = httpTest.expectJSON;
-- 
GitLab


From 813fc1a3e016163ad57aeac1b30430bbb31cf761 Mon Sep 17 00:00:00 2001
From: librelois <elois@ifee.fr>
Date: Fri, 13 Oct 2017 22:22:22 +0200
Subject: [PATCH 07/18] [fix] ProverConstant incomplete renaming

---
 test/integration/http_api.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/integration/http_api.js b/test/integration/http_api.js
index 43e8733a2..3e3bab9f7 100644
--- a/test/integration/http_api.js
+++ b/test/integration/http_api.js
@@ -13,7 +13,7 @@ const shutDownEngine  = require('./tools/shutDownEngine');
 const rp        = require('request-promise');
 const ws        = require('ws');
 
-require('../../app/modules/prover/lib/constants').Constants.CORES_MAXIMUM_USE_IN_PARALLEL = 1
+require('../../app/modules/prover/lib/constants').ProverConstants.CORES_MAXIMUM_USE_IN_PARALLEL = 1
 
 let server, server2, cat, toc
 
-- 
GitLab


From e322fa4a91566e764eb98e99e7b71bf3976661a6 Mon Sep 17 00:00:00 2001
From: librelois <elois@ifee.fr>
Date: Sat, 14 Oct 2017 00:08:29 +0200
Subject: [PATCH 08/18] update yarn.lock

---
 yarn.lock | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 60 insertions(+), 4 deletions(-)

diff --git a/yarn.lock b/yarn.lock
index 1eb4771b3..e31a5cf3e 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -51,6 +51,10 @@ acorn@^5.1.1:
   version "5.1.1"
   resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.1.1.tgz#53fe161111f912ab999ee887a90a0bc52822fd75"
 
+adm-zip@0.4.7:
+  version "0.4.7"
+  resolved "https://registry.yarnpkg.com/adm-zip/-/adm-zip-0.4.7.tgz#8606c2cbf1c426ce8c8ec00174447fd49b6eafc1"
+
 ajv-keywords@^1.0.0:
   version "1.5.1"
   resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.5.1.tgz#314dd0a4b3368fad3dfcdc54ede6171b886daf3c"
@@ -902,6 +906,28 @@ doctrine@^1.2.2:
     esutils "^2.0.2"
     isarray "^1.0.0"
 
+duniter-ui@^1.6.13:
+  version "1.6.13"
+  resolved "https://registry.yarnpkg.com/duniter-ui/-/duniter-ui-1.6.13.tgz#3f203152fc0e3e1cbae74c1a0353a620c82d72ee"
+  dependencies:
+    adm-zip "0.4.7"
+    body-parser "1.17.1"
+    co "4.6.0"
+    cors "2.8.2"
+    event-stream "3.3.4"
+    express "4.15.2"
+    express-fileupload "0.0.5"
+    fs-extra "2.1.2"
+    materialize-css "0.98.1"
+    moment "2.18.1"
+    node-pre-gyp "0.6.34"
+    q "1.5.0"
+    request "2.81.0"
+    request-promise "4.2.0"
+    rimraf "2.6.1"
+    tmp "0.0.31"
+    underscore "1.8.3"
+
 duplexer@~0.1.1:
   version "0.1.1"
   resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1"
@@ -1410,6 +1436,13 @@ from@~0:
   version "0.1.7"
   resolved "https://registry.yarnpkg.com/from/-/from-0.1.7.tgz#83c60afc58b9c56997007ed1a768b3ab303a44fe"
 
+fs-extra@2.1.2:
+  version "2.1.2"
+  resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-2.1.2.tgz#046c70163cef9aad46b0e4a7fa467fb22d71de35"
+  dependencies:
+    graceful-fs "^4.1.2"
+    jsonfile "^2.1.0"
+
 fs-extra@^0.22.1:
   version "0.22.1"
   resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-0.22.1.tgz#5fd6f8049dc976ca19eb2355d658173cabcce056"
@@ -1577,6 +1610,10 @@ growl@1.9.2:
   version "1.9.2"
   resolved "https://registry.yarnpkg.com/growl/-/growl-1.9.2.tgz#0ea7743715db8d8de2c5ede1775e1b45ac85c02f"
 
+hammerjs@^2.0.4:
+  version "2.0.8"
+  resolved "https://registry.yarnpkg.com/hammerjs/-/hammerjs-2.0.8.tgz#04ef77862cff2bb79d30f7692095930222bf60f1"
+
 handlebars@^4.0.3:
   version "4.0.10"
   resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.10.tgz#3d30c718b09a3d96f23ea4cc1f403c4d3ba9ff4f"
@@ -1997,6 +2034,10 @@ jison@0.4.17:
     lex-parser "~0.1.3"
     nomnom "1.5.2"
 
+jquery@^2.1.4:
+  version "2.2.4"
+  resolved "https://registry.yarnpkg.com/jquery/-/jquery-2.2.4.tgz#2c89d6889b5eac522a7eea32c14521559c6cbf02"
+
 js-tokens@^3.0.0:
   version "3.0.2"
   resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b"
@@ -2254,6 +2295,14 @@ map-stream@~0.1.0:
     buffers "~0.1.1"
     readable-stream "~1.0.0"
 
+materialize-css@0.98.1:
+  version "0.98.1"
+  resolved "https://registry.yarnpkg.com/materialize-css/-/materialize-css-0.98.1.tgz#7276895b2c998b53e26deaa0c23a0484c0851d99"
+  dependencies:
+    hammerjs "^2.0.4"
+    jquery "^2.1.4"
+    node-archiver "^0.3.0"
+
 md5-hex@^1.2.0:
   version "1.3.0"
   resolved "https://registry.yarnpkg.com/md5-hex/-/md5-hex-1.3.0.tgz#d2c4afe983c4370662179b8cad145219135046c4"
@@ -2482,6 +2531,13 @@ nnupnp@1.0.2:
     request "2.10.0"
     xml2js "0.1.14"
 
+node-archiver@^0.3.0:
+  version "0.3.0"
+  resolved "https://registry.yarnpkg.com/node-archiver/-/node-archiver-0.3.0.tgz#b9f1afe5006d0bdf29260181833a070978bc6947"
+  dependencies:
+    fstream "^1.0.10"
+    tar "^2.2.1"
+
 node-pre-gyp@0.6.23:
   version "0.6.23"
   resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.6.23.tgz#155bf3683abcfcde008aedab1248891a0773db95"
@@ -2899,7 +2955,7 @@ q-io@1.13.2:
     qs "^1.2.1"
     url2 "^0.0.0"
 
-q@^1.0.1:
+q@1.5.0, q@^1.0.1:
   version "1.5.0"
   resolved "https://registry.yarnpkg.com/q/-/q-1.5.0.tgz#dd01bac9d06d30e6f219aecb8253ee9ebdc308f1"
 
@@ -3204,7 +3260,7 @@ right-align@^0.1.1:
   dependencies:
     align-text "^0.1.1"
 
-rimraf@2, rimraf@^2.2.8, rimraf@^2.3.3, rimraf@^2.5.1, rimraf@^2.5.4, rimraf@^2.6.1:
+rimraf@2, rimraf@2.6.1, rimraf@^2.2.8, rimraf@^2.3.3, rimraf@^2.5.1, rimraf@^2.5.4, rimraf@^2.6.1:
   version "2.6.1"
   resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d"
   dependencies:
@@ -3311,7 +3367,7 @@ setprototypeof@1.0.3:
   version "1.0.3"
   resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.0.3.tgz#66567e37043eeb4f04d91bd658c0cbefb55b8e04"
 
-sha1@:
+sha1@1.1.1:
   version "1.1.1"
   resolved "https://registry.yarnpkg.com/sha1/-/sha1-1.1.1.tgz#addaa7a93168f393f19eb2b15091618e2700f848"
   dependencies:
@@ -3714,7 +3770,7 @@ tmp@0.0.29:
   dependencies:
     os-tmpdir "~1.0.1"
 
-tmp@^0.0.31:
+tmp@0.0.31, tmp@^0.0.31:
   version "0.0.31"
   resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.31.tgz#8f38ab9438e17315e5dbd8b3657e8bfb277ae4a7"
   dependencies:
-- 
GitLab


From 0c895de1ab39aeb5a7b39fc4b78414dabd00281e Mon Sep 17 00:00:00 2001
From: librelois <elois@ifee.fr>
Date: Sat, 14 Oct 2017 14:58:43 +0200
Subject: [PATCH 09/18] [mod] sandox change pubkey -> issuers[0]

---
 app/lib/dal/sqliteDAL/SandBox.ts | 2 +-
 app/service/IdentityService.ts   | 4 ++--
 app/service/MembershipService.ts | 4 ++--
 test/dal/triming.js              | 4 ----
 4 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/app/lib/dal/sqliteDAL/SandBox.ts b/app/lib/dal/sqliteDAL/SandBox.ts
index 48d736dc8..bdf3c427d 100644
--- a/app/lib/dal/sqliteDAL/SandBox.ts
+++ b/app/lib/dal/sqliteDAL/SandBox.ts
@@ -15,7 +15,7 @@ export class SandBox<T extends sandboxDocument> {
   }
   
   async acceptNewSandBoxEntry(element:T, pubkey:string) {
-    if (element.issuers.indexOf(pubkey) !== -1) {
+    if (element.issuers !== undefined && element.issuers.indexOf(pubkey) !== -1) {
       return true;
     }
     const elements = await this.findElements()
diff --git a/app/service/IdentityService.ts b/app/service/IdentityService.ts
index 7dc412240..e052aa29a 100644
--- a/app/service/IdentityService.ts
+++ b/app/service/IdentityService.ts
@@ -115,7 +115,7 @@ export class IdentityService extends FIFOService {
         await GLOBAL_RULES_FUNCTIONS.checkIdentitiesAreWritable({ identities: [idtyObj.inline()], version: (current && current.version) || constants.BLOCK_GENERATED_VERSION }, this.conf, this.dal);
         if (byAbsorption !== BY_ABSORPTION) {
           if (!(await this.dal.idtyDAL.sandbox.acceptNewSandBoxEntry({
-              pubkey: idty.pubkey,
+              issuers: [idty.pubkey],
               ref_block: parseInt(idty.buid.split('-')[0])
             }, this.conf.pair && this.conf.pair.pub))) {
             throw constants.ERRORS.SANDBOX_FOR_IDENTITY_IS_FULL;
@@ -240,7 +240,7 @@ export class IdentityService extends FIFOService {
           const idty = IdentityDTO.fromRevocation(revoc);
           idty.revocation_sig = revoc.revocation;
           if (!(await this.dal.idtyDAL.sandbox.acceptNewSandBoxEntry({
-              pubkey: idty.pubkey,
+              issuers: [idty.pubkey],
               ref_block: parseInt(idty.buid.split('-')[0]),
               certsCount: 0
             }, this.conf.pair && this.conf.pair.pub))) {
diff --git a/app/service/MembershipService.ts b/app/service/MembershipService.ts
index 5612493db..1cbb2d73c 100644
--- a/app/service/MembershipService.ts
+++ b/app/service/MembershipService.ts
@@ -56,14 +56,14 @@ export class MembershipService extends FIFOService {
       const current = await this.dal.getCurrentBlockOrNull();
       const basedBlock = await GLOBAL_RULES_HELPERS.checkMembershipBlock(entry, current, this.conf, this.dal);
       if (!(await this.dal.msDAL.sandbox.acceptNewSandBoxEntry({
-          pubkey: entry.pubkey,
+          issuers: [entry.pubkey],
           block_number: entry.block_number
         }, this.conf.pair && this.conf.pair.pub))) {
         throw constants.ERRORS.SANDBOX_FOR_MEMERSHIP_IS_FULL;
       }
       // Saves entry
       await this.dal.savePendingMembership({
-        issuers: [entry.issuer],
+        issuers: [entry.pubkey],
         membership: entry.membership,
         issuer: entry.issuer,
         number: entry.number,
diff --git a/test/dal/triming.js b/test/dal/triming.js
index db2c0cb84..501ec550e 100644
--- a/test/dal/triming.js
+++ b/test/dal/triming.js
@@ -124,10 +124,6 @@ describe("Triming", function(){
   it('should be able to trim the bindex', () => co(function *() {
     // Triming
     const server = (yield toolbox.simpleNodeWith2Users({
-      pair: {
-        pub: 'HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd',
-        sec: '51w4fEShBk1jCMauWu4mLpmDVfHksKmWcygpxriqCEZizbtERA6de4STKRkQBpxmMUwsKXRjSzuQ8ECwmqN1u2DP'
-      },
       forksize: 9,
       sigQty: 1,
       dtDiffEval: 2,
-- 
GitLab


From 2a95620ca88e46b97c1b5e61b5fc2a1b2f827067 Mon Sep 17 00:00:00 2001
From: librelois <elois@ifee.fr>
Date: Sat, 14 Oct 2017 15:14:14 +0200
Subject: [PATCH 10/18] Uppercase sandboxDocument -> SandboxDocument

---
 app/lib/dal/sqliteDAL/CertDAL.ts       | 4 ++--
 app/lib/dal/sqliteDAL/IdentityDAL.ts   | 4 ++--
 app/lib/dal/sqliteDAL/MembershipDAL.ts | 4 ++--
 app/lib/dal/sqliteDAL/SandBox.ts       | 4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/app/lib/dal/sqliteDAL/CertDAL.ts b/app/lib/dal/sqliteDAL/CertDAL.ts
index 0efb58f24..e940ef3d6 100644
--- a/app/lib/dal/sqliteDAL/CertDAL.ts
+++ b/app/lib/dal/sqliteDAL/CertDAL.ts
@@ -1,10 +1,10 @@
 import {SQLiteDriver} from "../drivers/SQLiteDriver"
 import {AbstractSQLite} from "./AbstractSQLite"
-import { SandBox, sandboxDocument } from './SandBox';
+import { SandBox, SandboxDocument } from './SandBox';
 
 const constants = require('../../constants');
 
-export interface DBCert extends sandboxDocument {
+export interface DBCert extends SandboxDocument {
   linked:boolean
   written:boolean
   written_block:null
diff --git a/app/lib/dal/sqliteDAL/IdentityDAL.ts b/app/lib/dal/sqliteDAL/IdentityDAL.ts
index 1445fb350..883db8028 100644
--- a/app/lib/dal/sqliteDAL/IdentityDAL.ts
+++ b/app/lib/dal/sqliteDAL/IdentityDAL.ts
@@ -1,6 +1,6 @@
 import {AbstractSQLite} from "./AbstractSQLite"
 import {SQLiteDriver} from "../drivers/SQLiteDriver"
-import { SandBox, sandboxDocument } from './SandBox';
+import { SandBox, SandboxDocument } from './SandBox';
 import {IdentityDTO} from "../../dto/IdentityDTO"
 import {Cloneable} from "../../dto/Cloneable";
 const constants = require('../../constants');
@@ -143,7 +143,7 @@ export class ExistingDBIdentity extends DBIdentity {
   }
 }
 
-export interface DBSandboxIdentity extends DBIdentity,sandboxDocument {
+export interface DBSandboxIdentity extends DBIdentity,SandboxDocument {
   certsCount: number
   ref_block: number
 }
diff --git a/app/lib/dal/sqliteDAL/MembershipDAL.ts b/app/lib/dal/sqliteDAL/MembershipDAL.ts
index 41557cf89..d35caf019 100644
--- a/app/lib/dal/sqliteDAL/MembershipDAL.ts
+++ b/app/lib/dal/sqliteDAL/MembershipDAL.ts
@@ -1,10 +1,10 @@
 import {SQLiteDriver} from "../drivers/SQLiteDriver";
 import {AbstractSQLite} from "./AbstractSQLite";
-import { SandBox, sandboxDocument } from './SandBox';
+import { SandBox, SandboxDocument } from './SandBox';
 const _ = require('underscore');
 const constants = require('../../constants');
 
-export interface DBMembership extends sandboxDocument {
+export interface DBMembership extends SandboxDocument {
   membership: string
   issuer: string
   number: number
diff --git a/app/lib/dal/sqliteDAL/SandBox.ts b/app/lib/dal/sqliteDAL/SandBox.ts
index bdf3c427d..652db5403 100644
--- a/app/lib/dal/sqliteDAL/SandBox.ts
+++ b/app/lib/dal/sqliteDAL/SandBox.ts
@@ -1,8 +1,8 @@
-export interface sandboxDocument {
+export interface SandboxDocument {
   issuers: string[];
 }
 
-export class SandBox<T extends sandboxDocument> {
+export class SandBox<T extends SandboxDocument> {
 
   maxSize:number
   
-- 
GitLab


From 1b7f0a83a72b431f501861a309474b2542038371 Mon Sep 17 00:00:00 2001
From: librelois <elois@ifee.fr>
Date: Sat, 14 Oct 2017 16:21:43 +0200
Subject: [PATCH 11/18] revert test typing (I will type only the product code
 in a first step)

---
 test/integration/documents-currency.ts | 26 +++++++++++++-------------
 test/integration/server-shutdown.ts    |  2 +-
 test/integration/tools/toolbox.ts      |  6 +++---
 3 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/test/integration/documents-currency.ts b/test/integration/documents-currency.ts
index 36c5e767b..36da15e85 100644
--- a/test/integration/documents-currency.ts
+++ b/test/integration/documents-currency.ts
@@ -8,26 +8,26 @@ const should    = require('should');
 const user      = require('./tools/user');
 const commit    = require('./tools/commit');
 
-let s1:TestingServer, s2:TestingServer, s1Conf:ConfDTO, s2Conf:ConfDTO, cat1:any, tac1:any, toc2:any, tic2:any;
+let s1:any, s2:any, cat1:any, tac1:any, toc2:any, tic2:any;
 
 describe("Document pool currency", function() {
 
   before(() => co(function*() {
 
-    s1 = NewTestingServer(ConfDTO.complete({
+    s1 = NewTestingServer({
       currency: 'currency_one',
       pair: {
-        pub: 'HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd',
-        sec: '51w4fEShBk1jCMauWu4mLpmDVfHksKmWcygpxriqCEZizbtERA6de4STKRkQBpxmMUwsKXRjSzuQ8ECwmqN1u2DP'
-      }
-    }));
-    s2 = NewTestingServer(ConfDTO.complete({
-      currency: 'currency_two',
-      pair: {
-        pub: 'DKpQPUL4ckzXYdnDRvCRKAm1gNvSdmAXnTrJZ7LvM5Qo',
-        sec: '64EYRvdPpTfLGGmaX5nijLXRqWXaVz8r1Z1GtaahXwVSJGQRn7tqkxLb288zwSYzELMEG5ZhXSBYSxsTsz1m9y8F'
-      }
-    }));
+          pub: 'HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd',
+          sec: '51w4fEShBk1jCMauWu4mLpmDVfHksKmWcygpxriqCEZizbtERA6de4STKRkQBpxmMUwsKXRjSzuQ8ECwmqN1u2DP'
+        }
+      });
+      s2 = NewTestingServer({
+        currency: 'currency_two',
+        pair: {
+          pub: 'DKpQPUL4ckzXYdnDRvCRKAm1gNvSdmAXnTrJZ7LvM5Qo',
+          sec: '64EYRvdPpTfLGGmaX5nijLXRqWXaVz8r1Z1GtaahXwVSJGQRn7tqkxLb288zwSYzELMEG5ZhXSBYSxsTsz1m9y8F'
+        }
+      });
 
     cat1 = user('cat', { pub: 'HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd', sec: '51w4fEShBk1jCMauWu4mLpmDVfHksKmWcygpxriqCEZizbtERA6de4STKRkQBpxmMUwsKXRjSzuQ8ECwmqN1u2DP'}, { server: s1 });
     tac1 = user('tac', { pub: '2LvDg21dVXvetTD9GdkPLURavLYEqP3whauvPWX4c2qc', sec: '2HuRLWgKgED1bVio1tdpeXrf7zuUszv1yPHDsDj7kcMC4rVSN9RC58ogjtKNfTbH1eFz7rn38U1PywNs3m6Q7UxE'}, { server: s1 });
diff --git a/test/integration/server-shutdown.ts b/test/integration/server-shutdown.ts
index 48af21914..033ef3076 100644
--- a/test/integration/server-shutdown.ts
+++ b/test/integration/server-shutdown.ts
@@ -8,7 +8,7 @@ const querablep = require('querablep')
 describe("Server shutdown", () => {
 
   it('should not interrupt a task in the documents FIFO', async () => {
-    const s1 = NewTestingServer(ConfDTO.defaultConf())
+    const s1 = NewTestingServer({})
 
     const fifo = s1._server.getDocumentsFIFO()
     const ops:any[] = []
diff --git a/test/integration/tools/toolbox.ts b/test/integration/tools/toolbox.ts
index a9e1249a2..fcf1e9670 100644
--- a/test/integration/tools/toolbox.ts
+++ b/test/integration/tools/toolbox.ts
@@ -218,10 +218,10 @@ export const fakeSyncServer = async (readBlocksMethod:any, readParticularBlockMe
  * Creates a new memory duniter server for Unit Test purposes.
  * @param conf
  */
-export const server = (conf:ConfDTO) => NewTestingServer(conf)
-export const simpleTestingServer = (conf:ConfDTO) => NewTestingServer(conf)
+export const server = (conf:any) => NewTestingServer(conf)
+export const simpleTestingServer = (conf:any) => NewTestingServer(conf)
 
-export const NewTestingServer = (conf:ConfDTO) => {
+export const NewTestingServer = (conf:any) => {
   const host = conf.host || HOST
   const port = conf.port || PORT++
   const commonConf = {
-- 
GitLab


From 955f16256668fcf1300058abf99d5b49f7375a24 Mon Sep 17 00:00:00 2001
From: librelois <elois@ifee.fr>
Date: Sat, 14 Oct 2017 16:35:48 +0200
Subject: [PATCH 12/18] move SandboxDocument -> DBDocument

---
 app/lib/dal/sqliteDAL/CertDAL.ts       | 5 +++--
 app/lib/dal/sqliteDAL/DocumentDAL.ts   | 3 +++
 app/lib/dal/sqliteDAL/IdentityDAL.ts   | 5 +++--
 app/lib/dal/sqliteDAL/MembershipDAL.ts | 5 +++--
 app/lib/dal/sqliteDAL/SandBox.ts       | 6 ++----
 5 files changed, 14 insertions(+), 10 deletions(-)
 create mode 100644 app/lib/dal/sqliteDAL/DocumentDAL.ts

diff --git a/app/lib/dal/sqliteDAL/CertDAL.ts b/app/lib/dal/sqliteDAL/CertDAL.ts
index e940ef3d6..d12774e57 100644
--- a/app/lib/dal/sqliteDAL/CertDAL.ts
+++ b/app/lib/dal/sqliteDAL/CertDAL.ts
@@ -1,10 +1,11 @@
 import {SQLiteDriver} from "../drivers/SQLiteDriver"
 import {AbstractSQLite} from "./AbstractSQLite"
-import { SandBox, SandboxDocument } from './SandBox';
+import { SandBox } from './SandBox';
+import { DBDocument } from './DocumentDAL';
 
 const constants = require('../../constants');
 
-export interface DBCert extends SandboxDocument {
+export interface DBCert extends DBDocument {
   linked:boolean
   written:boolean
   written_block:null
diff --git a/app/lib/dal/sqliteDAL/DocumentDAL.ts b/app/lib/dal/sqliteDAL/DocumentDAL.ts
new file mode 100644
index 000000000..d427e3e5f
--- /dev/null
+++ b/app/lib/dal/sqliteDAL/DocumentDAL.ts
@@ -0,0 +1,3 @@
+export interface DBDocument {
+  issuers: string[];
+}
\ No newline at end of file
diff --git a/app/lib/dal/sqliteDAL/IdentityDAL.ts b/app/lib/dal/sqliteDAL/IdentityDAL.ts
index 883db8028..364eb00cd 100644
--- a/app/lib/dal/sqliteDAL/IdentityDAL.ts
+++ b/app/lib/dal/sqliteDAL/IdentityDAL.ts
@@ -1,8 +1,9 @@
 import {AbstractSQLite} from "./AbstractSQLite"
 import {SQLiteDriver} from "../drivers/SQLiteDriver"
-import { SandBox, SandboxDocument } from './SandBox';
+import { SandBox } from './SandBox';
 import {IdentityDTO} from "../../dto/IdentityDTO"
 import {Cloneable} from "../../dto/Cloneable";
+import { DBDocument } from './DocumentDAL';
 const constants = require('../../constants');
 
 export abstract class DBIdentity implements Cloneable {
@@ -143,7 +144,7 @@ export class ExistingDBIdentity extends DBIdentity {
   }
 }
 
-export interface DBSandboxIdentity extends DBIdentity,SandboxDocument {
+export interface DBSandboxIdentity extends DBIdentity,DBDocument {
   certsCount: number
   ref_block: number
 }
diff --git a/app/lib/dal/sqliteDAL/MembershipDAL.ts b/app/lib/dal/sqliteDAL/MembershipDAL.ts
index d35caf019..110ed1429 100644
--- a/app/lib/dal/sqliteDAL/MembershipDAL.ts
+++ b/app/lib/dal/sqliteDAL/MembershipDAL.ts
@@ -1,10 +1,11 @@
 import {SQLiteDriver} from "../drivers/SQLiteDriver";
 import {AbstractSQLite} from "./AbstractSQLite";
-import { SandBox, SandboxDocument } from './SandBox';
+import { SandBox } from './SandBox';
+import { DBDocument } from './DocumentDAL';
 const _ = require('underscore');
 const constants = require('../../constants');
 
-export interface DBMembership extends SandboxDocument {
+export interface DBMembership extends DBDocument {
   membership: string
   issuer: string
   number: number
diff --git a/app/lib/dal/sqliteDAL/SandBox.ts b/app/lib/dal/sqliteDAL/SandBox.ts
index 652db5403..8a0d3077d 100644
--- a/app/lib/dal/sqliteDAL/SandBox.ts
+++ b/app/lib/dal/sqliteDAL/SandBox.ts
@@ -1,8 +1,6 @@
-export interface SandboxDocument {
-  issuers: string[];
-}
+import { DBDocument } from './DocumentDAL';
 
-export class SandBox<T extends SandboxDocument> {
+export class SandBox<T extends DBDocument> {
 
   maxSize:number
   
-- 
GitLab


From 5f8f3b784b35dc00ecb60ec793f2a407852b9bfd Mon Sep 17 00:00:00 2001
From: librelois <elois@ifee.fr>
Date: Sat, 14 Oct 2017 20:33:47 +0200
Subject: [PATCH 13/18] {fix] try to repair integration tests

---
 app/lib/dto/ConfDTO.ts | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/app/lib/dto/ConfDTO.ts b/app/lib/dto/ConfDTO.ts
index 3c14e4809..a1729fe90 100644
--- a/app/lib/dto/ConfDTO.ts
+++ b/app/lib/dto/ConfDTO.ts
@@ -157,8 +157,8 @@ export class ConfDTO implements CurrencyConfDTO, KeypairConfDTO, NetworkConfDTO,
   }
 
   static defaultConf() {
-    return new ConfDTO("", "", [], [], 0, 3600 * 1000, constants.PROOF_OF_WORK.DEFAULT.CPU, 1, constants.PROOF_OF_WORK.DEFAULT.PREFIX, 0, 0, constants.CONTRACT.DEFAULT.C, constants.CONTRACT.DEFAULT.DT, constants.CONTRACT.DEFAULT.DT_REEVAL, 0, constants.CONTRACT.DEFAULT.UD0, 0, 0, constants.CONTRACT.DEFAULT.STEPMAX, constants.CONTRACT.DEFAULT.SIGPERIOD, 0, constants.CONTRACT.DEFAULT.SIGVALIDITY, constants.CONTRACT.DEFAULT.MSVALIDITY, constants.CONTRACT.DEFAULT.SIGQTY, constants.CONTRACT.DEFAULT.SIGSTOCK, constants.CONTRACT.DEFAULT.X_PERCENT, constants.CONTRACT.DEFAULT.PERCENTROT, constants.CONTRACT.DEFAULT.POWDELAY, constants.CONTRACT.DEFAULT.AVGGENTIME, constants.CONTRACT.DEFAULT.MEDIANTIMEBLOCKS, false, 3000, false, constants.BRANCHES.DEFAULT_WINDOW_SIZE, constants.CONTRACT.DEFAULT.IDTYWINDOW, constants.CONTRACT.DEFAULT.MSWINDOW, constants.CONTRACT.DEFAULT.SIGWINDOW, 0, { pub:'', sec:'' }, null, "", "", 0, "", "", "", "", 0, "", "", null, false, "", true, true)
-    /*return {
+    /*return new ConfDTO("", "", [], [], 0, 3600 * 1000, constants.PROOF_OF_WORK.DEFAULT.CPU, 1, constants.PROOF_OF_WORK.DEFAULT.PREFIX, 0, 0, constants.CONTRACT.DEFAULT.C, constants.CONTRACT.DEFAULT.DT, constants.CONTRACT.DEFAULT.DT_REEVAL, 0, constants.CONTRACT.DEFAULT.UD0, 0, 0, constants.CONTRACT.DEFAULT.STEPMAX, constants.CONTRACT.DEFAULT.SIGPERIOD, 0, constants.CONTRACT.DEFAULT.SIGVALIDITY, constants.CONTRACT.DEFAULT.MSVALIDITY, constants.CONTRACT.DEFAULT.SIGQTY, constants.CONTRACT.DEFAULT.SIGSTOCK, constants.CONTRACT.DEFAULT.X_PERCENT, constants.CONTRACT.DEFAULT.PERCENTROT, constants.CONTRACT.DEFAULT.POWDELAY, constants.CONTRACT.DEFAULT.AVGGENTIME, constants.CONTRACT.DEFAULT.MEDIANTIMEBLOCKS, false, 3000, false, constants.BRANCHES.DEFAULT_WINDOW_SIZE, constants.CONTRACT.DEFAULT.IDTYWINDOW, constants.CONTRACT.DEFAULT.MSWINDOW, constants.CONTRACT.DEFAULT.SIGWINDOW, 0, { pub:'', sec:'' }, null, "", "", 0, "", "", "", "", 0, "", "", null, false, "", true, true)*/
+    return {
       "currency": null,
       "endpoints": [],
       "rmEndpoints": [],
@@ -184,7 +184,7 @@ export class ConfDTO implements CurrencyConfDTO, KeypairConfDTO, NetworkConfDTO,
       "isolate": false,
       "forksize": constants.BRANCHES.DEFAULT_WINDOW_SIZE,
       "switchOnHeadAdvance": CommonConstants.SWITCH_ON_BRANCH_AHEAD_BY_X_BLOCKS
-    };*/
+    };
   }
 
   static complete(conf:any) {
-- 
GitLab


From 5a190a7aae9766bf0d393406d8c49b85d7f4e049 Mon Sep 17 00:00:00 2001
From: cgeek <cem.moreau@gmail.com>
Date: Tue, 14 Nov 2017 18:38:05 +0100
Subject: [PATCH 14/18] [enh] Remove unecessary comment, hash is well filled in

---
 app/lib/dal/sqliteDAL/TxsDAL.ts | 1 -
 1 file changed, 1 deletion(-)

diff --git a/app/lib/dal/sqliteDAL/TxsDAL.ts b/app/lib/dal/sqliteDAL/TxsDAL.ts
index 204ae8277..dbc82ca99 100644
--- a/app/lib/dal/sqliteDAL/TxsDAL.ts
+++ b/app/lib/dal/sqliteDAL/TxsDAL.ts
@@ -173,7 +173,6 @@ export class TxsDAL extends AbstractSQLite<DBTx> {
     dbTx.received = moment().unix()
     dbTx.written = false
     dbTx.removed = false
-    //dbTx.hash = tx.getHash()
     return this.saveEntity(dbTx)
   }
 
-- 
GitLab


From 04d22756e4f15e27e8027faae4ccbfc0714c67ae Mon Sep 17 00:00:00 2001
From: cgeek <cem.moreau@gmail.com>
Date: Tue, 14 Nov 2017 18:38:31 +0100
Subject: [PATCH 15/18] [enh] Sandbox: keep `pubkey` + add `issuer` control

---
 app/lib/dal/sqliteDAL/DocumentDAL.ts | 4 +++-
 app/lib/dal/sqliteDAL/SandBox.ts     | 6 ++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/app/lib/dal/sqliteDAL/DocumentDAL.ts b/app/lib/dal/sqliteDAL/DocumentDAL.ts
index d427e3e5f..a60aa335e 100644
--- a/app/lib/dal/sqliteDAL/DocumentDAL.ts
+++ b/app/lib/dal/sqliteDAL/DocumentDAL.ts
@@ -1,3 +1,5 @@
 export interface DBDocument {
-  issuers: string[];
+  pubkey?: string
+  issuer?: string
+  issuers?: string[]
 }
\ No newline at end of file
diff --git a/app/lib/dal/sqliteDAL/SandBox.ts b/app/lib/dal/sqliteDAL/SandBox.ts
index 8a0d3077d..85ae101c5 100644
--- a/app/lib/dal/sqliteDAL/SandBox.ts
+++ b/app/lib/dal/sqliteDAL/SandBox.ts
@@ -1,4 +1,4 @@
-import { DBDocument } from './DocumentDAL';
+import {DBDocument} from './DocumentDAL';
 
 export class SandBox<T extends DBDocument> {
 
@@ -13,7 +13,9 @@ export class SandBox<T extends DBDocument> {
   }
   
   async acceptNewSandBoxEntry(element:T, pubkey:string) {
-    if (element.issuers !== undefined && element.issuers.indexOf(pubkey) !== -1) {
+    if (element.pubkey === pubkey
+      || element.issuer === pubkey
+      || (element.issuers !== undefined && element.issuers.indexOf(pubkey) !== -1)) {
       return true;
     }
     const elements = await this.findElements()
-- 
GitLab


From 1408b5d05e6ae4258754b219188d69bf670923a6 Mon Sep 17 00:00:00 2001
From: cgeek <cem.moreau@gmail.com>
Date: Tue, 14 Nov 2017 18:44:58 +0100
Subject: [PATCH 16/18] [enh] Sandbox: also missing the `from` case

---
 app/lib/dal/sqliteDAL/DocumentDAL.ts | 7 ++++---
 app/lib/dal/sqliteDAL/SandBox.ts     | 2 ++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/app/lib/dal/sqliteDAL/DocumentDAL.ts b/app/lib/dal/sqliteDAL/DocumentDAL.ts
index a60aa335e..fe8fc2e0b 100644
--- a/app/lib/dal/sqliteDAL/DocumentDAL.ts
+++ b/app/lib/dal/sqliteDAL/DocumentDAL.ts
@@ -1,5 +1,6 @@
 export interface DBDocument {
-  pubkey?: string
-  issuer?: string
-  issuers?: string[]
+  pubkey?: string     // idty table
+  from?: string       // cert table
+  issuer?: string     // membership table
+  issuers?: string[]  // txs table
 }
\ No newline at end of file
diff --git a/app/lib/dal/sqliteDAL/SandBox.ts b/app/lib/dal/sqliteDAL/SandBox.ts
index 85ae101c5..fe96af44e 100644
--- a/app/lib/dal/sqliteDAL/SandBox.ts
+++ b/app/lib/dal/sqliteDAL/SandBox.ts
@@ -13,7 +13,9 @@ export class SandBox<T extends DBDocument> {
   }
   
   async acceptNewSandBoxEntry(element:T, pubkey:string) {
+    // Accept any document which has the exception pubkey (= the node pubkey)
     if (element.pubkey === pubkey
+      || element.from === pubkey
       || element.issuer === pubkey
       || (element.issuers !== undefined && element.issuers.indexOf(pubkey) !== -1)) {
       return true;
-- 
GitLab


From f253bb6b9a5595062f0282b9c1b221aa7bd277fa Mon Sep 17 00:00:00 2001
From: cgeek <cem.moreau@gmail.com>
Date: Tue, 14 Nov 2017 18:54:26 +0100
Subject: [PATCH 17/18] [fix] Revert my 2 lasts commits: original sandbox case
 was good

---
 app/lib/dal/sqliteDAL/DocumentDAL.ts | 5 +----
 app/lib/dal/sqliteDAL/SandBox.ts     | 5 +----
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/app/lib/dal/sqliteDAL/DocumentDAL.ts b/app/lib/dal/sqliteDAL/DocumentDAL.ts
index fe8fc2e0b..d2097d7f0 100644
--- a/app/lib/dal/sqliteDAL/DocumentDAL.ts
+++ b/app/lib/dal/sqliteDAL/DocumentDAL.ts
@@ -1,6 +1,3 @@
 export interface DBDocument {
-  pubkey?: string     // idty table
-  from?: string       // cert table
-  issuer?: string     // membership table
-  issuers?: string[]  // txs table
+  issuers?: string[]
 }
\ No newline at end of file
diff --git a/app/lib/dal/sqliteDAL/SandBox.ts b/app/lib/dal/sqliteDAL/SandBox.ts
index fe96af44e..09431c3aa 100644
--- a/app/lib/dal/sqliteDAL/SandBox.ts
+++ b/app/lib/dal/sqliteDAL/SandBox.ts
@@ -14,10 +14,7 @@ export class SandBox<T extends DBDocument> {
   
   async acceptNewSandBoxEntry(element:T, pubkey:string) {
     // Accept any document which has the exception pubkey (= the node pubkey)
-    if (element.pubkey === pubkey
-      || element.from === pubkey
-      || element.issuer === pubkey
-      || (element.issuers !== undefined && element.issuers.indexOf(pubkey) !== -1)) {
+    if (element.issuers !== undefined && element.issuers.indexOf(pubkey) !== -1) {
       return true;
     }
     const elements = await this.findElements()
-- 
GitLab


From 89fa0a52c56dfc8968890b0b05f0374d31510afb Mon Sep 17 00:00:00 2001
From: cgeek <cem.moreau@gmail.com>
Date: Tue, 14 Nov 2017 19:04:44 +0100
Subject: [PATCH 18/18] [fix] Wrong import

---
 app/modules/prover/index.ts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/modules/prover/index.ts b/app/modules/prover/index.ts
index 624f456d4..856e14237 100644
--- a/app/modules/prover/index.ts
+++ b/app/modules/prover/index.ts
@@ -22,7 +22,7 @@ export const ProverDependency = {
           conf.cpu = ProverConstants.DEFAULT_CPU;
         }
         if (conf.nbCores === null || conf.nbCores === undefined) {
-          conf.nbCores = Math.min(Constants.CORES_MAXIMUM_USE_IN_PARALLEL, require('os').cpus().length)
+          conf.nbCores = Math.min(ProverConstants.CORES_MAXIMUM_USE_IN_PARALLEL, require('os').cpus().length)
         } else if (conf.nbCores <= 0) {
           conf.nbCores = 1
         }
-- 
GitLab