diff --git a/app/lib/computation/blockchainContext.js b/app/lib/computation/blockchainContext.js index 6a5d87d7b0b17578f59379eab5a8ba91085af8b0..37c431d29d2f46697c6014e232bcec8bef22ec62 100644 --- a/app/lib/computation/blockchainContext.js +++ b/app/lib/computation/blockchainContext.js @@ -535,6 +535,9 @@ function BlockchainContext() { conf.avgGenTime = bconf.avgGenTime; conf.dtDiffEval = bconf.dtDiffEval; conf.percentRot = bconf.percentRot; + conf.udTime0 = bconf.udTime0; + conf.udReevalTime0 = bconf.udReevalTime0; + conf.dtReeval = bconf.dtReeval; conf.currency = block.currency; // Super important: adapt wotb module to handle the correct stock dal.wotb.setMaxCert(conf.sigStock); diff --git a/app/lib/constants.js b/app/lib/constants.js index e709036809764947105cf1b5a40a33eb6314b3d8..bf62f8fee6099f4ae8c75725dc7aac51ba17893c 100644 --- a/app/lib/constants.js +++ b/app/lib/constants.js @@ -188,7 +188,7 @@ module.exports = { BLOCK_ISSUERS_FRAME:find('IssuersFrame: (' + INTEGER + ')'), BLOCK_ISSUERS_FRAME_VAR:find('IssuersFrameVar: (' + RELATIVE_INTEGER + ')'), DIFFERENT_ISSUERS_COUNT:find('DifferentIssuersCount: (' + INTEGER + ')'), - PARAMETERS: find("Parameters: (" + FLOAT + ":" + INTEGER + ":" + INTEGER + ":" + INTEGER + ":" + INTEGER + ":" + INTEGER + ":" + INTEGER + ":" + INTEGER + ":" + INTEGER + ":" + INTEGER + ":" + FLOAT + ":" + INTEGER + ":" + INTEGER + ":" + INTEGER + ":" + INTEGER + ":" + INTEGER + ":" + FLOAT + ")"), + PARAMETERS: find("Parameters: (" + FLOAT + ":" + INTEGER + ":" + INTEGER + ":" + INTEGER + ":" + INTEGER + ":" + INTEGER + ":" + INTEGER + ":" + INTEGER + ":" + INTEGER + ":" + INTEGER + ":" + FLOAT + ":" + INTEGER + ":" + INTEGER + ":" + INTEGER + ":" + INTEGER + ":" + INTEGER + ":" + FLOAT + ":" + INTEGER + ":" + INTEGER + ":" + INTEGER + ")"), JOINER: exact(PUBKEY + ":" + SIGNATURE + ":" + BLOCK_UID + ":" + BLOCK_UID + ":" + USER_ID), ACTIVE: exact(PUBKEY + ":" + SIGNATURE + ":" + BLOCK_UID + ":" + BLOCK_UID + ":" + USER_ID), LEAVER: exact(PUBKEY + ":" + SIGNATURE + ":" + BLOCK_UID + ":" + BLOCK_UID + ":" + USER_ID), @@ -261,6 +261,7 @@ module.exports = { DEFAULT: { C: 0.007376575, DT: 30.4375 * 24 * 3600, + DT_REEVAL: 30.4375 * 24 * 3600, UD0: 100, STEPMAX: 3, SIGDELAY: 3600 * 24 * 365 * 5, diff --git a/app/lib/dal/sqliteDAL/index/BIndexDAL.js b/app/lib/dal/sqliteDAL/index/BIndexDAL.js index 9d5b80b743e6116c2a953cbda6ec787fe3892be3..d46ca9b72e4363bf7f92c9f0dfd0fe958b35e83e 100644 --- a/app/lib/dal/sqliteDAL/index/BIndexDAL.js +++ b/app/lib/dal/sqliteDAL/index/BIndexDAL.js @@ -35,6 +35,7 @@ function BIndexDAL(driver) { 'unitBase', 'powMin', 'udTime', + 'udReevalTime', 'diffNumber', 'speed' ]; @@ -65,6 +66,7 @@ function BIndexDAL(driver) { 'unitBase INTEGER NOT NULL,' + 'powMin INTEGER NOT NULL,' + 'udTime INTEGER NOT NULL,' + + 'udReevalTime INTEGER NOT NULL,' + 'diffNumber INTEGER NOT NULL,' + 'speed FLOAT NOT NULL,' + 'PRIMARY KEY (number)' + diff --git a/app/lib/dup/indexer.js b/app/lib/dup/indexer.js index 2d52a073b260c8a4a816333e6d3084359555e1bc..3938a82fe37433e7691e65eaa030eee3c3f0cd3b 100644 --- a/app/lib/dup/indexer.js +++ b/app/lib/dup/indexer.js @@ -814,27 +814,42 @@ const indexer = module.exports = { // BR_G11 prepareUDTime: (HEAD, HEAD_1, conf) => { + // UD Production if (HEAD.number == 0) { - HEAD.udTime = HEAD.medianTime + conf.dt; + HEAD.udTime = conf.udTime0; } else if (HEAD_1.udTime <= HEAD.medianTime) { HEAD.udTime = HEAD_1.udTime + conf.dt; } else { HEAD.udTime = HEAD_1.udTime; } + // UD Reevaluation + if (HEAD.number == 0) { + HEAD.udReevalTime = conf.udReevalTime0; + } else if (HEAD_1.udReevalTime <= HEAD.medianTime) { + HEAD.udReevalTime = HEAD_1.udReevalTime + conf.dtReeval; + } else { + HEAD.udReevalTime = HEAD_1.udReevalTime; + } }, // BR_G13 prepareDividend: (HEAD, HEAD_1, conf) => { + // UD re-evaluation if (HEAD.number == 0) { HEAD.dividend = conf.ud0; - HEAD.new_dividend = null; - } else if (HEAD.udTime != HEAD_1.udTime) { + } else if (HEAD.udReevalTime != HEAD_1.udReevalTime) { // DUG const previousUB = HEAD_1.unitBase; HEAD.dividend = Math.ceil(HEAD_1.dividend + Math.pow(conf.c, 2) * Math.ceil(HEAD_1.mass / Math.pow(10, previousUB)) / HEAD.membersCount); - HEAD.new_dividend = HEAD.dividend; } else { HEAD.dividend = HEAD_1.dividend; + } + // UD creation + if (HEAD.number == 0) { + HEAD.new_dividend = null; + } else if (HEAD.udTime != HEAD_1.udTime) { + HEAD.new_dividend = HEAD.dividend; + } else { HEAD.new_dividend = null; } }, diff --git a/app/lib/entity/block.js b/app/lib/entity/block.js index 01463aa0c85f8d13c84957be09713eee2d3cbf93..91404fb6313f235b1f4ebd72fa06eeb5e43f0f3e 100644 --- a/app/lib/entity/block.js +++ b/app/lib/entity/block.js @@ -242,5 +242,8 @@ Block.statics.getConf = (block) => { bconf.avgGenTime = parseInt(sp[14]); bconf.dtDiffEval = parseInt(sp[15]); bconf.percentRot = parseFloat(sp[16]); + bconf.udTime0 = parseInt(sp[17]); + bconf.udReevalTime0 = parseInt(sp[18]); + bconf.dtReeval = parseInt(sp[19]); return bconf; }; diff --git a/app/lib/entity/configuration.js b/app/lib/entity/configuration.js index 331342371dad7d4e6839306adfd6077d99cbf842..e2793622e9d98b7bd73f98a4479863de244c6855 100644 --- a/app/lib/entity/configuration.js +++ b/app/lib/entity/configuration.js @@ -10,6 +10,7 @@ const defaultConf = function() { "upInterval": 3600 * 1000, "c": constants.CONTRACT.DEFAULT.C, "dt": constants.CONTRACT.DEFAULT.DT, + "dtReeval": constants.CONTRACT.DEFAULT.DT_REEVAL, "ud0": constants.CONTRACT.DEFAULT.UD0, "stepMax": constants.CONTRACT.DEFAULT.STEPMAX, "sigPeriod": constants.CONTRACT.DEFAULT.SIGPERIOD, diff --git a/doc/Protocol.md b/doc/Protocol.md index 77df8b38b57b5f9b39a9d352299f442f2b123085..03954bfc1c76a5adf6d57448f6324e550218e3e1 100644 --- a/doc/Protocol.md +++ b/doc/Protocol.md @@ -854,7 +854,7 @@ To be valid, a block must match the following rules: * `Transactions` is a multiline field composed of [compact transactions](#compact-format) * `Parameters` is a simple line field, composed of 1 float, 12 integers and 1 last float all separated by a colon `:`, and representing [currency parameters](#protocol-parameters) (a.k.a Protocol parameters, but valued for a given currency): - c:dt:ud0:sigPeriod:sigStock:sigWindow:sigValidity:sigQty:idtyWindow:msWindow:xpercent:msValidity:stepMax:medianTimeBlocks:avgGenTime:dtDiffEval:percentRot + c:dt:ud0:sigPeriod:sigStock:sigWindow:sigValidity:sigQty:idtyWindow:msWindow:xpercent:msValidity:stepMax:medianTimeBlocks:avgGenTime:dtDiffEval:percentRot:udTime0:udReevalTime0:dtReeval The document must be ended with a `BOTTOM_SIGNATURE` [Signature](#signature). @@ -953,8 +953,11 @@ The document must be ended with a `BOTTOM_SIGNATURE` [Signature](#signature). Parameter | Goal ----------- | ---- c | The %growth of the UD every `[dt]` period -dt | Time period between two UD +dt | Time period between two UD. +dtReeval | Time period between two re-evaluation of the UD. ud0 | UD(0), i.e. initial Universal Dividend +udTime0 | Time of first UD. +udReevalTime0 | Time of first reevaluation of the UD. sigPeriod | Minimum delay between 2 certifications of a same issuer, in seconds. Must be positive or zero. sigStock | Maximum quantity of active certifications made by member. sigWindow | Maximum delay a certification can wait before being expired for non-writing. @@ -1576,11 +1579,11 @@ Else: HEAD.membersCount = HEAD~1.membersCount + COUNT(LOCAL_IINDEX[member=true]) - COUNT(LOCAL_IINDEX[member=false]) -###### BR_G11 - HEAD.udTime +###### BR_G11 - HEAD.udTime and HEAD.udReevalTime If `HEAD.number == 0`: - HEAD.udTime = HEAD.medianTime + dt + HEAD.udTime = udTime0 Else if `HEAD~1.udTime <= HEAD.medianTime`: @@ -1589,6 +1592,22 @@ Else if `HEAD~1.udTime <= HEAD.medianTime`: Else: HEAD.udTime = HEAD~1.udTime + +EndIf + +If `HEAD.number == 0`: + + HEAD.udReevalTime = udReevalTime0 + +Else if `HEAD~1.udReevalTime <= HEAD.medianTime`: + + HEAD.udReevalTime = HEAD~1.udReevalTime + dtReeval + +Else: + + HEAD.udReevalTime = HEAD~1.udReevalTime + +EndIf ###### BR_G12 - HEAD.unitBase @@ -1605,16 +1624,27 @@ Else: If `HEAD.number == 0`: HEAD.dividend = ud0 + +Else If `HEAD.udReevalTime != HEAD~1.udReevalTime`: + + HEAD.dividend = HEAD_1.dividend + c² * CEIL(HEAD~1.mass / POW(10, HEAD~1.unitbase)) / HEAD.membersCount) + +Else: + + HEAD.dividend = HEAD~1.dividend + +EndIf + +If `HEAD.number == 0`: + HEAD.new_dividend = null -If `HEAD.udTime != HEAD~1.udTime`: +Else If `HEAD.udTime != HEAD~1.udTime`: - HEAD.dividend = CEIL(HEAD~1.dividend + c² * CEIL(HEAD~1.mass / POW(10, HEAD~1.unitbase)) / HEAD.membersCount) HEAD.new_dividend = HEAD.dividend Else: - HEAD.dividend = HEAD~1.dividend HEAD.new_dividend = null ###### BR_G14 - HEAD.dividend and HEAD.unitbase and HEAD.new_dividend diff --git a/package.json b/package.json index e652efbd9fd4080f1fe8beb07f954c7132b82ed0..676398dae9aa4522207990082e291b9d82767433 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "duniter-common": "0.1.0", "duniter-crawler": "^0.2.16", "duniter-keypair": "^0.3.0", - "duniter-prover": "^0.2.9", + "duniter-prover": "^1.0.0", "event-stream": "3.3.4", "inquirer": "0.8.5", "jison": "0.4.17", diff --git a/test/dal/triming.js b/test/dal/triming.js index 770a344013cddbd4044010d35e200f4b121f41f9..f56d067d8a15ca9868fc45cc5b7846acad999986 100644 --- a/test/dal/triming.js +++ b/test/dal/triming.js @@ -17,11 +17,11 @@ describe("Triming", function(){ it('should be able to feed the bindex', () => co(function *() { yield dal.bindexDAL.insertBatch([ - { number: 121, version: 6, bsize: 0, hash: "HASH", issuer: "ISSUER", time: 0, membersCount: 3, issuersCount: 2, issuersFrame: 1, issuersFrameVar: 2, avgBlockSize: 0, medianTime: 1482500000, dividend: 100, mass: 300, unitBase: 2, powMin: 70, udTime: 0, diffNumber: 5, speed: 1.0 }, - { number: 122, version: 6, bsize: 0, hash: "HASH", issuer: "ISSUER", time: 0, membersCount: 3, issuersCount: 2, issuersFrame: 1, issuersFrameVar: 2, avgBlockSize: 0, medianTime: 1482500000, dividend: 100, mass: 300, unitBase: 2, powMin: 70, udTime: 0, diffNumber: 5, speed: 1.0 }, - { number: 123, version: 6, bsize: 0, hash: "HASH", issuer: "ISSUER", time: 0, membersCount: 3, issuersCount: 2, issuersFrame: 1, issuersFrameVar: 2, avgBlockSize: 0, medianTime: 1482500000, dividend: 100, mass: 300, unitBase: 2, powMin: 70, udTime: 0, diffNumber: 5, speed: 1.0 }, - { number: 124, version: 6, bsize: 0, hash: "HASH", issuer: "ISSUER", time: 0, membersCount: 3, issuersCount: 2, issuersFrame: 1, issuersFrameVar: 2, avgBlockSize: 0, medianTime: 1482500000, dividend: 100, mass: 300, unitBase: 2, powMin: 70, udTime: 0, diffNumber: 5, speed: 1.0 }, - { number: 125, version: 6, bsize: 0, hash: "HASH", issuer: "ISSUER", time: 0, membersCount: 3, issuersCount: 2, issuersFrame: 1, issuersFrameVar: 2, avgBlockSize: 0, medianTime: 1482500000, dividend: 100, mass: 300, unitBase: 2, powMin: 70, udTime: 0, diffNumber: 5, speed: 1.0 } + { number: 121, version: 6, bsize: 0, hash: "HASH", issuer: "ISSUER", time: 0, membersCount: 3, issuersCount: 2, issuersFrame: 1, issuersFrameVar: 2, avgBlockSize: 0, medianTime: 1482500000, dividend: 100, mass: 300, unitBase: 2, powMin: 70, udTime: 0, udReevalTime: 0, diffNumber: 5, speed: 1.0 }, + { number: 122, version: 6, bsize: 0, hash: "HASH", issuer: "ISSUER", time: 0, membersCount: 3, issuersCount: 2, issuersFrame: 1, issuersFrameVar: 2, avgBlockSize: 0, medianTime: 1482500000, dividend: 100, mass: 300, unitBase: 2, powMin: 70, udTime: 0, udReevalTime: 0, diffNumber: 5, speed: 1.0 }, + { number: 123, version: 6, bsize: 0, hash: "HASH", issuer: "ISSUER", time: 0, membersCount: 3, issuersCount: 2, issuersFrame: 1, issuersFrameVar: 2, avgBlockSize: 0, medianTime: 1482500000, dividend: 100, mass: 300, unitBase: 2, powMin: 70, udTime: 0, udReevalTime: 0, diffNumber: 5, speed: 1.0 }, + { number: 124, version: 6, bsize: 0, hash: "HASH", issuer: "ISSUER", time: 0, membersCount: 3, issuersCount: 2, issuersFrame: 1, issuersFrameVar: 2, avgBlockSize: 0, medianTime: 1482500000, dividend: 100, mass: 300, unitBase: 2, powMin: 70, udTime: 0, udReevalTime: 0, diffNumber: 5, speed: 1.0 }, + { number: 125, version: 6, bsize: 0, hash: "HASH", issuer: "ISSUER", time: 0, membersCount: 3, issuersCount: 2, issuersFrame: 1, issuersFrameVar: 2, avgBlockSize: 0, medianTime: 1482500000, dividend: 100, mass: 300, unitBase: 2, powMin: 70, udTime: 0, udReevalTime: 0, diffNumber: 5, speed: 1.0 } ]); })); diff --git a/test/data/blockchain.json b/test/data/blockchain.json index 75cc03f829593d89285bbbce415a058549549b2b..9c985447dc6dab559aad14e26e456b98fb68805c 100644 --- a/test/data/blockchain.json +++ b/test/data/blockchain.json @@ -16,12 +16,12 @@ "len": 6, "currency": "duniter_unit_test_currency", "issuer": "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd", - "signature": "+ROmUNXfqITwDAe6laDRLKImdmBNGseQGzvIhoYv2sqXnsbaE4HhKNCFZuw2DrOO//Z8uouMgZUQCaqIacHsBw==", - "hash": "8E336B655B18CD7E2AFE5E9E178D46D6640EBC6354A3DC89ADF6A4C5EE9E83B8", - "parameters": "0.99:300:9995:0:40:604800:31536000:1:604800:604800:0.9:31536000:3:1:5000:10:0.6666666666666666", + "signature": "PBFMqPiRTdgUHQdVyUEc4m0vAw+hfK4gP9/cxqJMZm4sqPRHMEwHc2lyxWQwb9G/L7OduaXa0m0mVhRErLueDw==", + "hash": "4B776FA22B16BC52A03E5BEC0435AD6D55E6E82F443E4DE905FF7D809735B208", + "parameters": "0.99:300:9995:0:40:604800:31536000:1:604800:604800:0.9:31536000:3:1:5000:10:0.6666666666666666:1480000300:1480000300:300", "previousHash": null, "previousIssuer": null, - "inner_hash": "CB76B02685CFF0071A14B9FF7DC6B2A96C1A6A8D5059D300ADAC8675734A8777", + "inner_hash": "B7E0D4830FBBAD337CB70EED3F057102D40051CE7348D9C040B9C35D79AF146F", "dividend": null, "identities": [ "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd:kdg4GA3wNnXt+u/gP9uD34lGhzClhMylDpJew5zhtkQAz84oscNQtDXpvooCWzVsS1kZ25MaH42eL7kOq+sUCg==:0-E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855:cat", @@ -43,7 +43,7 @@ }, { "version": 10, - "nonce": 100000000001, + "nonce": 100000000002, "number": 1, "powMin": 0, "time": 1480000300, @@ -57,12 +57,12 @@ "len": 0, "currency": "duniter_unit_test_currency", "issuer": "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd", - "signature": "M0JJFbwqlBRqH7xZSfavJV7jyDILVJjgyEAJEdg+uss3P+GDqvlR1tb5qeQ4uhqxRZ81ugp6if04wAOfBeskDg==", - "hash": "5B92D05E2949D56FEDD1C24A76CF039861EFB54725E8E635568B96142A067D4E", + "signature": "b4G1benKmPAqkZbXUqnm3xk/rNR9QLBrHdRmqEgjCmjNMELk5ZlbIflPJqN8FaKBtOvlS0w90rcGIbqsBR4wBQ==", + "hash": "A97F97CDFE5755B2553663AAA788F419ABDBC6DDABE7064F2E29213D63B6677A", "parameters": "", - "previousHash": "8E336B655B18CD7E2AFE5E9E178D46D6640EBC6354A3DC89ADF6A4C5EE9E83B8", + "previousHash": "4B776FA22B16BC52A03E5BEC0435AD6D55E6E82F443E4DE905FF7D809735B208", "previousIssuer": "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd", - "inner_hash": "8C288BEC7B81AA66E3E10445B9587DA4A9EE481DE916FCB9896D808CC0FCD98C", + "inner_hash": "B899A9957654878ACD2C17E25498E4EC3FA5640732912BE22F18686FEC91DF5C", "dividend": null, "identities": [], "joiners": [], @@ -89,12 +89,12 @@ "len": 0, "currency": "duniter_unit_test_currency", "issuer": "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd", - "signature": "mVjTQmQPsz49IMDyWXZARvn5kfonX81qcZUS6wKmKXte0kSem1Eu/q6ZJMV0/LMcILyXMrUrPsvSAwl+QzzOAQ==", - "hash": "224A337B7EF2D9206C19C81070E90EF37DEAF5678308790E63096119ABF7FED6", + "signature": "WdX95cp30pIameTDFpJUW0edT5hdE32Ms1rl8e0o4BIFfVVVfoOFnywGwlmKGHcBEhttHcFtYEFhaF1gzq20Ag==", + "hash": "ABDDADC611E48D1658501E68036F6250F2591A1C6265FD2AFFBB21FBD68CBB77", "parameters": "", - "previousHash": "5B92D05E2949D56FEDD1C24A76CF039861EFB54725E8E635568B96142A067D4E", + "previousHash": "A97F97CDFE5755B2553663AAA788F419ABDBC6DDABE7064F2E29213D63B6677A", "previousIssuer": "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd", - "inner_hash": "91D0BE95402369E619DCB5BA008D12FCCF96853E26F67BCFC3F640B852E9188B", + "inner_hash": "0F1563F15793DD900AB265278F0043B0FDF51B5C8F37759BC9C2436792241046", "dividend": 9995, "identities": [], "joiners": [], @@ -121,12 +121,12 @@ "len": 8, "currency": "duniter_unit_test_currency", "issuer": "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd", - "signature": "i+VIzH3ipC2C0oLtUNozRZJ1Sfyz1DWjmXG6Z9KHyH+nLQpXW2eiQRfsuiXrAVMQE/5wemyJCspER4u0F5xFAw==", - "hash": "82DB0F5ABA211E7A9BE4FCE1DC5DC7DBDF37CA07FDA9E552323975C9DDD6BF4F", + "signature": "auA3aA9JJzylL22NvcU6Q5JBm0bpTm6i0k+HYuwcESSql3zK6cvSwzj8tytvSPIp5m1toMAlWgyg6N8ZZqGqCg==", + "hash": "22F8CF714806514B5B9AF2F00084EEA73009713E0588E16D88AE20A4858FEB6C", "parameters": "", - "previousHash": "224A337B7EF2D9206C19C81070E90EF37DEAF5678308790E63096119ABF7FED6", + "previousHash": "ABDDADC611E48D1658501E68036F6250F2591A1C6265FD2AFFBB21FBD68CBB77", "previousIssuer": "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd", - "inner_hash": "4076D1E3B8A4E00C3CEFA5BAC88CB615FDD1520A917FB5A512FC7EA4B3929A12", + "inner_hash": "575C69507C3AB44A1E21A4CBDC9CBEC8E6C845C2A3CCB96303C3464331122311", "dividend": null, "identities": [], "joiners": [], @@ -138,7 +138,7 @@ "transactions": [ { "version": 10, - "blockstamp": "2-224A337B7EF2D9206C19C81070E90EF37DEAF5678308790E63096119ABF7FED6", + "blockstamp": "2-ABDDADC611E48D1658501E68036F6250F2591A1C6265FD2AFFBB21FBD68CBB77", "locktime": 0, "issuers": [ "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd" @@ -150,12 +150,12 @@ "0:SIG(0)" ], "outputs": [ - "3000:0:SIG(2LvDg21dVXvetTD9GdkPLURavLYEqP3whauvPWX4c2qc)", - "6995:0:SIG(HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd)" + "2999:0:SIG(2LvDg21dVXvetTD9GdkPLURavLYEqP3whauvPWX4c2qc)", + "6996:0:SIG(HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd)" ], "comments": [], "signatures": [ - "9FcU1O2xETZhjYzzeH5h1m6bNElvH19FlGH+UyrrXZr471rIc1NpyKA+g+0gw01coUG0gFfheRGpCsMgsq0iAg==" + "CcABNeZDNXft/k2fplMAHshN4i3Jcp+Ixrami7gs3ICtFqw5nAs1AaJJLfxPr+CvXdE8473D8bu57wnfarZGCg==" ], "comment": "", "currency": "duniter_unit_test_currency", @@ -180,12 +180,12 @@ "len": 8, "currency": "duniter_unit_test_currency", "issuer": "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd", - "signature": "ElgbeXSenPf2nA/3mceCP7uSUy5TWqxzK9FZ+rkcM+k6ICFM5aLyVa8EZP3oAMitUDvI0RInp010rMid9Kt8Dw==", - "hash": "B663792962579F4B7FF35C428AA5C352CA54492A4634B69AE42EFAB9840D4EB6", + "signature": "w5vLqsAti58nrsJJndMdJ6+r5VuOOrFy0SfzF2jVriRTkQ/gTzRTNl+v4XJwDsyNeL14EeJvxDCGiu28gqQzAw==", + "hash": "919E463FC10AC54457739D3B0FA63D40CD436DC72E4574E1CBF09FFD9B5058D6", "parameters": "", - "previousHash": "82DB0F5ABA211E7A9BE4FCE1DC5DC7DBDF37CA07FDA9E552323975C9DDD6BF4F", + "previousHash": "22F8CF714806514B5B9AF2F00084EEA73009713E0588E16D88AE20A4858FEB6C", "previousIssuer": "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd", - "inner_hash": "F3FCF1ACF928991D558AE59A388525FB9F78B03BE5723E67082D6C6EB5F51331", + "inner_hash": "61C58D4212F826FA86D12D5E9D4598252595D0EB7FA18616E4BF6715156A9A75", "dividend": null, "identities": [], "joiners": [], @@ -197,24 +197,24 @@ "transactions": [ { "version": 10, - "blockstamp": "3-82DB0F5ABA211E7A9BE4FCE1DC5DC7DBDF37CA07FDA9E552323975C9DDD6BF4F", + "blockstamp": "3-22F8CF714806514B5B9AF2F00084EEA73009713E0588E16D88AE20A4858FEB6C", "locktime": 0, "issuers": [ "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd" ], "inputs": [ - "6995:0:T:693C54130D1D393767347F657D074FA471E0844FC1CF35A6FDEAC68849737A01:1" + "6996:0:T:E84C72FBE788F6F52B293676A8314A6F227F14B0A8FD0168E1C4F08E85D1F8E9:1" ], "unlocks": [ "0:SIG(0)" ], "outputs": [ - "5495:0:SIG(2LvDg21dVXvetTD9GdkPLURavLYEqP3whauvPWX4c2qc)", - "1500:0:SIG(HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd)" + "1:0:SIG(2LvDg21dVXvetTD9GdkPLURavLYEqP3whauvPWX4c2qc)", + "6995:0:SIG(HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd)" ], "comments": [], "signatures": [ - "m1ilWGfhXnkngZ4ZBNAESLAct83vDSK0GzvFgkV8Mp9Fg7T4gax07lG7RIFj7vPn8K4BUObnFQ4C73eD318NBQ==" + "7Oiujg+TezElOGkSiHBi5HGu2rdLZTJnIUTq7XQIMZ0bfseTDiZLBZFI1pKuuj4uSSZ6mwDtxMN1iYCq22K+BA==" ], "comment": "", "currency": "duniter_unit_test_currency", @@ -239,12 +239,12 @@ "len": 8, "currency": "duniter_unit_test_currency", "issuer": "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd", - "signature": "sylWufEKQyN5hinCRg9pI2v9Lf60wBa+lqI1CLq8KbN1v91y1FaQj8QEj4hqsnPRSOvZd+3I5uotDcxnd2VLAA==", - "hash": "17E879B63BB95A6C04D150E9F6F3171F44E644AE4A6E21C8FEE1FA88526593EA", + "signature": "OZMDpxcUeCzJbZO+vNnRdCpGqeHvchLvv8iBSFKbhBotj6ZpOQwerqJ/Uoo4eIdF2dOYYWLqi4tzdmYMke8UBA==", + "hash": "556C20BEB55FBEE1C5067A379EFB55F74727741D76F01DBEC9230617E1D8B19F", "parameters": "", - "previousHash": "B663792962579F4B7FF35C428AA5C352CA54492A4634B69AE42EFAB9840D4EB6", + "previousHash": "919E463FC10AC54457739D3B0FA63D40CD436DC72E4574E1CBF09FFD9B5058D6", "previousIssuer": "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd", - "inner_hash": "68424CBE1D58AA15A4A446606DD48E7CE718663DF3B6DACC693D4AC227DFEC19", + "inner_hash": "3E632B8E68CE3B54EE3B3B3509F6C370877CD41373D8F6B274B263252C6B35AD", "dividend": null, "identities": [], "joiners": [], @@ -256,24 +256,24 @@ "transactions": [ { "version": 10, - "blockstamp": "4-B663792962579F4B7FF35C428AA5C352CA54492A4634B69AE42EFAB9840D4EB6", + "blockstamp": "4-919E463FC10AC54457739D3B0FA63D40CD436DC72E4574E1CBF09FFD9B5058D6", "locktime": 0, "issuers": [ "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd" ], "inputs": [ - "1500:0:T:1E47AF2308490CD7480CD509F3D031B9F1E0DEE9E40FEC9CF9462CEE412C0710:1" + "6995:0:T:50844926EC611BF6BBF9918A657F87E0AA0DE5A5D8DB3D476289BF64C6ED8C25:1" ], "unlocks": [ "0:SIG(0)" ], "outputs": [ - "1:0:SIG(6EQoFVnFf2xpaRzieNTXmAKU6XkDHYrvgorJ8ppMFa8b)", - "1499:0:SIG(HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd)" + "5495:0:SIG(2LvDg21dVXvetTD9GdkPLURavLYEqP3whauvPWX4c2qc)", + "1500:0:SIG(HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd)" ], "comments": [], "signatures": [ - "aFgEWGJAt8jk9elmCO1MAxqR+EO4a4C4zt6mfPD3FZNQOgqOPc3RaQ0BLVHdcTaefk/wrWEaiB30kmcKuKbOCA==" + "XTuTwiRJxzvtMEzFuuTYrXeUcedAhp6UJDh4l79C2pMNYTtCki0vzBzCWEbqpVz0BFJakoiDVMzxhp10EwRIBw==" ], "comment": "", "currency": "duniter_unit_test_currency", @@ -298,12 +298,12 @@ "len": 8, "currency": "duniter_unit_test_currency", "issuer": "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd", - "signature": "gSlXYjIn2Cy9p4iCOvu6awEy5JPkgs3bTehjlR91KSPn28z8R8GUUZWtLLCp1/RFTxV+EzWmGIacUeShSzn2AA==", - "hash": "550B5EB68E256519244BB7AB8C20786E59318EA7F7937B39BE4838641C4427E6", + "signature": "J3Uo950Zyst8KpdaqoruwZwwEi0bUMUbEqdGKs0ebKfUzL+K6lQKNw8+uVLjp5x3hON7sBCTRy8Mn2krAmBkBA==", + "hash": "7672117AD7A2F8387AC6372FE7DA2618D20661FD159ED8E695BCFABDF080AAE9", "parameters": "", - "previousHash": "17E879B63BB95A6C04D150E9F6F3171F44E644AE4A6E21C8FEE1FA88526593EA", + "previousHash": "556C20BEB55FBEE1C5067A379EFB55F74727741D76F01DBEC9230617E1D8B19F", "previousIssuer": "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd", - "inner_hash": "A1FCB7719F9DFE2701B59333CB8140FEEE07112564370EBDF79D0DFAD4F72461", + "inner_hash": "330140744B0B37BA875F90586D2DFF3355A0C08BDBB95EC6BECC049335530CA2", "dividend": null, "identities": [], "joiners": [], @@ -315,24 +315,24 @@ "transactions": [ { "version": 10, - "blockstamp": "5-17E879B63BB95A6C04D150E9F6F3171F44E644AE4A6E21C8FEE1FA88526593EA", + "blockstamp": "5-556C20BEB55FBEE1C5067A379EFB55F74727741D76F01DBEC9230617E1D8B19F", "locktime": 0, "issuers": [ "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd" ], "inputs": [ - "1499:0:T:EC82DA278CC068C456480E783847814BD7B94A8B4C01751FA98ECB6269420055:1" + "1500:0:T:DA453C8B6300F06AC538D7EFB154DA9AE51F30D525236B9D4AD13944E18AA1B0:1" ], "unlocks": [ "0:SIG(0)" ], "outputs": [ - "99:0:SIG(2EvWF9XM6TY3zUDjwi3qfGRW5zhN11TXcUDXdgK2XK41)", - "1400:0:SIG(HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd)" + "1:0:SIG(6EQoFVnFf2xpaRzieNTXmAKU6XkDHYrvgorJ8ppMFa8b)", + "1499:0:SIG(HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd)" ], "comments": [], "signatures": [ - "4tFYR6F8xLztyWzWy/9V9K1p2eFTSnCxoir3nfMAo7esz8+WdFsNHYRxSoN8izYj7oESvRZezkOxgFZYcCwbCA==" + "IZWp8BX2nbEIhlIjULR4yA4TPjVIKJarqD0rwy3XB8Yu2PNUBYOYFAvGS77bFVl0QO91GPpetIgkk+ju7+1eAA==" ], "comment": "", "currency": "duniter_unit_test_currency", @@ -357,12 +357,12 @@ "len": 8, "currency": "duniter_unit_test_currency", "issuer": "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd", - "signature": "ZQrIH3Dwc/01SEAecFzJXD2PML7LTZoRFnrk99g4dMs0jmSZDvMA48p7Xq1Nkm0bSZ/lKNC8WnCikRoF0sDFCQ==", - "hash": "F0B4504EAB57E3F7314A73A18BC936D6C2D7838277AE79F523635F532F008F11", + "signature": "Ypcfoc27Mwm0ef3QXLD9oKTFBdclLA7e0dGJdorOb+I4uwOgaZFQtE6bD59G7UoKLrYj1blvEX4MsWSKOyeiDw==", + "hash": "19809DFAB3494410A545636D4D6BEBA19851C33E300753AF7175C638B3252B46", "parameters": "", - "previousHash": "550B5EB68E256519244BB7AB8C20786E59318EA7F7937B39BE4838641C4427E6", + "previousHash": "7672117AD7A2F8387AC6372FE7DA2618D20661FD159ED8E695BCFABDF080AAE9", "previousIssuer": "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd", - "inner_hash": "CB738835E9AC4CB5FC2F0CF9472A0560EBC4A18CD4A9FE5B7D44BECDC19C4471", + "inner_hash": "6A2FC5075A94C90C794B7832089ACA20A80E977A5BD4ECC35E1B271F09ADFDA1", "dividend": null, "identities": [], "joiners": [], @@ -374,24 +374,24 @@ "transactions": [ { "version": 10, - "blockstamp": "6-550B5EB68E256519244BB7AB8C20786E59318EA7F7937B39BE4838641C4427E6", + "blockstamp": "6-7672117AD7A2F8387AC6372FE7DA2618D20661FD159ED8E695BCFABDF080AAE9", "locktime": 0, "issuers": [ "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd" ], "inputs": [ - "1400:0:T:3245C4AA564213EE8C292ADD5C35D7AEA5AC3CE7932E68F3C37DED1C60990CA5:1" + "1499:0:T:A6F2C3DFF8EFEBE226F103E86193A8F22A51D25DD63C2BB9BF86D9A5F3DC55B8:1" ], "unlocks": [ "0:SIG(0)" ], "outputs": [ - "100:0:SIG(DPFgnVSB14QnYFjKNhbFRYLxroSmaXZ53TzgFZBcCxbF)", - "1300:0:SIG(HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd)" + "99:0:SIG(2EvWF9XM6TY3zUDjwi3qfGRW5zhN11TXcUDXdgK2XK41)", + "1400:0:SIG(HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd)" ], "comments": [], "signatures": [ - "4/2neIATkINNT8L+0KhIaD8sktRAsySyaE+7yalw7Ay9/Xg6c+Wnzb0ZDF76xIWmS338Gd78l8jUwDs0q6Y0Bw==" + "ZOFga+kwbnUqXOare6rEhyzQdtW/S7MRnfCXAsVz7+D6SKbJj9OSjD9PwlNHOyVNTQLTKQL0L9YlG+Gq/W5xBw==" ], "comment": "", "currency": "duniter_unit_test_currency", @@ -416,12 +416,12 @@ "len": 8, "currency": "duniter_unit_test_currency", "issuer": "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd", - "signature": "2qLOlrXOgb0e+BYPDVLh7GNR+jiEOgeptnCS45rO0U1BMREh1Gtb790eCulHUFIY73beX608vfdWVuRYNHGlAg==", - "hash": "F14FF7F1BB7B4FE7376995508DC52BC0071A7796C68D3F5225FF2054A98B7B95", + "signature": "9Qsguxm0OGAkmGquSNBP126O39agARD6ZIB+VxfStJkPpMK4T8u6Rkj6s5wSf1zIpMtaelFKiH4UPo0rBqxvDw==", + "hash": "050A9D36F87024F767A84AE444D16D7A6DF1B72918B0587768FDF62D319A0C39", "parameters": "", - "previousHash": "F0B4504EAB57E3F7314A73A18BC936D6C2D7838277AE79F523635F532F008F11", + "previousHash": "19809DFAB3494410A545636D4D6BEBA19851C33E300753AF7175C638B3252B46", "previousIssuer": "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd", - "inner_hash": "306287D1F14E984D75B20DF42B787E5A1252D2543228B7F4532CB2B5077A913D", + "inner_hash": "1E8983A9AE9EFDE602A97C0EF87DA7728CF1BE539A854FDF8510E2A8EF96AD16", "dividend": null, "identities": [], "joiners": [], @@ -433,24 +433,24 @@ "transactions": [ { "version": 10, - "blockstamp": "7-F0B4504EAB57E3F7314A73A18BC936D6C2D7838277AE79F523635F532F008F11", + "blockstamp": "7-19809DFAB3494410A545636D4D6BEBA19851C33E300753AF7175C638B3252B46", "locktime": 0, "issuers": [ "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd" ], "inputs": [ - "1300:0:T:5218AA814F5AE71BF9ECF2DC86D8E8D85968F98E220D2E12DB6AAEFD2CD9EEE0:1" + "1400:0:T:F1C86F38F33B2D37561EE927801D8B630BCADA62336E4BBC718BA06B1101584C:1" ], "unlocks": [ "0:SIG(0)" ], "outputs": [ - "999:0:SIG(4WmQWq4NuJtu6mzFDKkmmu6Cm6BZvgoY4b4MMDMwVvu7)", - "301:0:SIG(HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd)" + "100:0:SIG(DPFgnVSB14QnYFjKNhbFRYLxroSmaXZ53TzgFZBcCxbF)", + "1300:0:SIG(HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd)" ], "comments": [], "signatures": [ - "CAegVJIEaysMrv6sRZRRQPO9BTZfJB5oSpo2/y/9OCUWwv7cA6LvYMtXgSdDvoGgzJJa2NzxCkQjA6vBrni+Dw==" + "keBrKUqRzMfx+YMXbRAiygOhPo90UESQ6SmX9GMRsHJDnHieke24xsXiNJvSIwFxP8A9aP6tLvPg/GFmaWrRAA==" ], "comment": "", "currency": "duniter_unit_test_currency", @@ -464,7 +464,7 @@ "nonce": 100000000001, "number": 9, "powMin": 0, - "time": 1480000900, + "time": 1480000300, "medianTime": 1480000300, "membersCount": 2, "monetaryMass": 19990, @@ -475,12 +475,12 @@ "len": 16, "currency": "duniter_unit_test_currency", "issuer": "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd", - "signature": "pyNNE4Afc7ZCLn/OdRtvrnhJf9oL/X/qswRsqF75m3bX8ldVP4TJJqa6H+KB1XlV920wMdXSmQA3M5AdCt0mBA==", - "hash": "78CB9C74839CAC5726032810DCD2BE30B7C1B664CF8111C733D2FE548CCE38A2", + "signature": "Iw0erkjb6Etqy0NnZ3JFnup1kzSfvVYKofpxqtujAkBNMo1GFdZJDmp0txKVUuW8C1VjuMVBMpYuI0VXF9XOAQ==", + "hash": "CB0B5D591CC73102DBBE731884B9EBA780F84EB033B4D3BBE19FEA8DB0B13F9D", "parameters": "", - "previousHash": "F14FF7F1BB7B4FE7376995508DC52BC0071A7796C68D3F5225FF2054A98B7B95", + "previousHash": "050A9D36F87024F767A84AE444D16D7A6DF1B72918B0587768FDF62D319A0C39", "previousIssuer": "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd", - "inner_hash": "B576E194DC1D6DA0F8FB7D7FB20C9CCBA457C6382C0DE4CFBC6B464C777ADD88", + "inner_hash": "7A7EB27C6FE5C6AC6A7D1097A119936814B91DCA3222589B41CD9D6603B480AF", "dividend": null, "identities": [], "joiners": [], @@ -492,54 +492,141 @@ "transactions": [ { "version": 10, - "blockstamp": "8-F14FF7F1BB7B4FE7376995508DC52BC0071A7796C68D3F5225FF2054A98B7B95", + "blockstamp": "8-050A9D36F87024F767A84AE444D16D7A6DF1B72918B0587768FDF62D319A0C39", + "locktime": 0, + "issuers": [ + "2LvDg21dVXvetTD9GdkPLURavLYEqP3whauvPWX4c2qc" + ], + "inputs": [ + "9995:0:D:2LvDg21dVXvetTD9GdkPLURavLYEqP3whauvPWX4c2qc:2" + ], + "unlocks": [ + "0:SIG(0)" + ], + "outputs": [ + "4:0:SIG(HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd)", + "9991:0:SIG(2LvDg21dVXvetTD9GdkPLURavLYEqP3whauvPWX4c2qc)" + ], + "comments": [], + "signatures": [ + "2Rc2aSKOO+qvUJpxFJ64+tx7B5fIDfwQqH719xOUSLfyTNQXUzeY5KNUw4nwk2gv6AS8AEQiNWx/m6N3lmLdAg==" + ], + "comment": "", + "currency": "duniter_unit_test_currency", + "block_number": 9, + "time": 1480000300 + }, + { + "version": 10, + "blockstamp": "8-050A9D36F87024F767A84AE444D16D7A6DF1B72918B0587768FDF62D319A0C39", "locktime": 0, "issuers": [ "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd" ], "inputs": [ - "301:0:T:F603AD88714A83A0B3C68BA14E311C55CD81F609C033B18501BAE1C8A21CB174:1" + "1300:0:T:0FAD3D25899C789C1C2B12FE3D90BF26E5794FB31ECF5072A881DF9B83E7CA00:1" ], "unlocks": [ "0:SIG(0)" ], "outputs": [ - "300:0:SIG(7kMAi8wttYKPK5QSfCwoDriNTcCTWKzTbuSjsLsjGJX2)", - "1:0:SIG(HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd)" + "999:0:SIG(4WmQWq4NuJtu6mzFDKkmmu6Cm6BZvgoY4b4MMDMwVvu7)", + "301:0:SIG(HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd)" ], "comments": [], "signatures": [ - "pHEcJB+FBgDEWKxTeI0LTpdMUm4YaFZc9VLkpjXnf/xYgEq0joks2cT7LU6Nr3PMpqR58IfTLiIuWeni5XtLBQ==" + "1r90zlvq3xKcgf1g9tY9n3KzMiwobdrfJYe7Cjeo8K+Jw5+d7Aerd9vLMqK8Y5wIL49Av/lOdfRmcwqxutTHDw==" ], "comment": "", "currency": "duniter_unit_test_currency", "block_number": 9, "time": 1480000300 + } + ] + }, + { + "version": 10, + "nonce": 100000000001, + "number": 10, + "powMin": 1, + "time": 1480000900, + "medianTime": 1480000300, + "membersCount": 2, + "monetaryMass": 19990, + "unitbase": 0, + "issuersCount": 1, + "issuersFrame": 6, + "issuersFrameVar": 0, + "len": 18, + "currency": "duniter_unit_test_currency", + "issuer": "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd", + "signature": "GLNVBH1YlcVW8oakj3tTCHixX1Fcg+VbMAFGH+2CznBGIgYWIvjTB0zdmzNFSmmBos7jJ1+dH0iFwvQeCQgeCQ==", + "hash": "012FCFA205F23EE9AA8C041625785AB031FD5E8BED58C46A72E85E1002CED001", + "parameters": "", + "previousHash": "CB0B5D591CC73102DBBE731884B9EBA780F84EB033B4D3BBE19FEA8DB0B13F9D", + "previousIssuer": "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd", + "inner_hash": "78423BD3BAF675A32848D84D6B151F722A66A8FD51436272ECD468ECA4FAC429", + "dividend": null, + "identities": [], + "joiners": [], + "actives": [], + "leavers": [], + "revoked": [], + "excluded": [], + "certifications": [], + "transactions": [ + { + "version": 10, + "blockstamp": "9-CB0B5D591CC73102DBBE731884B9EBA780F84EB033B4D3BBE19FEA8DB0B13F9D", + "locktime": 0, + "issuers": [ + "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd" + ], + "inputs": [ + "4:0:T:3B12EEC97704A8CCA31AFD7B60BA09555744703E22A6A47EE4ECBE6DA20B27E5:0", + "301:0:T:9B18E2C2CBF9C856560E76F8684665C8677DD0506AAD5195960E30CC37A5706C:1" + ], + "unlocks": [ + "0:SIG(0)", + "1:SIG(0)" + ], + "outputs": [ + "300:0:SIG(7kMAi8wttYKPK5QSfCwoDriNTcCTWKzTbuSjsLsjGJX2)", + "5:0:SIG(HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd)" + ], + "comments": [], + "signatures": [ + "fBvHesFaqBR+oiybh076bOD9wzrNRR3UEL6RcaFfLNwf1zKeGWmrAc6axIsmVuhMcreiODlQcFvLQKuuH6A/Bw==" + ], + "comment": "", + "currency": "duniter_unit_test_currency", + "block_number": 10, + "time": 1480000300 }, { "version": 10, - "blockstamp": "8-F14FF7F1BB7B4FE7376995508DC52BC0071A7796C68D3F5225FF2054A98B7B95", + "blockstamp": "9-CB0B5D591CC73102DBBE731884B9EBA780F84EB033B4D3BBE19FEA8DB0B13F9D", "locktime": 0, "issuers": [ "2LvDg21dVXvetTD9GdkPLURavLYEqP3whauvPWX4c2qc" ], "inputs": [ - "9995:0:D:2LvDg21dVXvetTD9GdkPLURavLYEqP3whauvPWX4c2qc:2" + "2999:0:T:E84C72FBE788F6F52B293676A8314A6F227F14B0A8FD0168E1C4F08E85D1F8E9:0" ], "unlocks": [ "0:SIG(0)" ], "outputs": [ "700:0:SIG(7kMAi8wttYKPK5QSfCwoDriNTcCTWKzTbuSjsLsjGJX2)", - "9295:0:SIG(2LvDg21dVXvetTD9GdkPLURavLYEqP3whauvPWX4c2qc)" + "2299:0:SIG(2LvDg21dVXvetTD9GdkPLURavLYEqP3whauvPWX4c2qc)" ], "comments": [], "signatures": [ - "wSrAUv8DGtaT7kHnmklxAXDHaKc1SGj3ICYqpyppOte2ihs4NCwN4YjNLJhfFr6qEHUcfLKQf3iwlTvAcMzVBg==" + "1yuPcN97qG7p7VcyHGxseoZTQx8qEMe9pMH/84hgUemd9X8Vg3BCpXgZXXDJgLUDOKksKTM8e3aoRHhz09ohAQ==" ], "comment": "", "currency": "duniter_unit_test_currency", - "block_number": 9, + "block_number": 10, "time": 1480000300 } ] @@ -547,7 +634,7 @@ { "version": 10, "nonce": 100000000001, - "number": 10, + "number": 11, "powMin": 1, "time": 1480000900, "medianTime": 1480000900, @@ -560,12 +647,12 @@ "len": 0, "currency": "duniter_unit_test_currency", "issuer": "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd", - "signature": "Ffa54r3CpYrd8/k4oiFSXIfxA/xaM5+X8MGZdqoqqt6emrObGlOgsnh5OUWWlpCdgA/b6ZFmRb2aG6DVciFBAQ==", - "hash": "144275EBEB7CB3E5B508F80CED5D75ACEA0A65B933E381B5DB0A31FAF0E6EA29", + "signature": "e4uKt8qIAP+AShaCWmFRVbrkOiCkkMupRj2LL3rOMSIYYSz7RIyaX2xwobOkcEUTZeG4/1mPdMkKg+czlXAiBA==", + "hash": "E55F97AFE990B0DE5E1B3CE98EAF4F9A65B907A9BFBE9C222A17506BD8EC5061", "parameters": "", - "previousHash": "78CB9C74839CAC5726032810DCD2BE30B7C1B664CF8111C733D2FE548CCE38A2", + "previousHash": "012FCFA205F23EE9AA8C041625785AB031FD5E8BED58C46A72E85E1002CED001", "previousIssuer": "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd", - "inner_hash": "DFACF4DE1A328D54055E034CA812B77F8F0FBCCC3E3D1B547F575EC5A103C469", + "inner_hash": "D85BA527336453C5C89F359DDFFEDC02A8B8BB1EE5AF35FBBDEB519DC6E76AC3", "dividend": 1980, "identities": [], "joiners": [], @@ -579,7 +666,7 @@ { "version": 10, "nonce": 100000000001, - "number": 11, + "number": 12, "powMin": 1, "time": 1480001800, "medianTime": 1480000900, @@ -592,12 +679,12 @@ "len": 0, "currency": "duniter_unit_test_currency", "issuer": "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd", - "signature": "A2w0d4LZtqdSOMGA5zIf4+cG/WPu1Yf0RGM4UFA4UdSNH9oXcAOOEjVK8tcNdDR85QXzUCMGGhYONnMKHCioCQ==", - "hash": "A46C0ED42C43C43769E98FB15C6CB050B2DDACBDB8A977010B4F77BF9D6BBD0D", + "signature": "7NANBYFqoUKGOGTB53gpEiC6K12frgUx747Is3iQs7pwtJBNCP7bUnAzMsZ/yZ0kUB8mzPsXhZ0/gRGaYT9LCA==", + "hash": "2E3A789AFE1461B9CBE58A55EA47E6B7BE70938CC275AACE98283DF12B9C717F", "parameters": "", - "previousHash": "144275EBEB7CB3E5B508F80CED5D75ACEA0A65B933E381B5DB0A31FAF0E6EA29", + "previousHash": "E55F97AFE990B0DE5E1B3CE98EAF4F9A65B907A9BFBE9C222A17506BD8EC5061", "previousIssuer": "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd", - "inner_hash": "39B02A6B0B205144BA85F19FD50A5B1C272BFEFA97A31574412EED538BA7B668", + "inner_hash": "9FE128B18BBE82A5202B42C2A1D051C891490CBF2433C93D392587FA3E79630F", "dividend": 4901, "identities": [], "joiners": [], @@ -611,7 +698,7 @@ { "version": 10, "nonce": 100000000001, - "number": 12, + "number": 13, "powMin": 1, "time": 1480003600, "medianTime": 1480001800, @@ -624,12 +711,12 @@ "len": 0, "currency": "duniter_unit_test_currency", "issuer": "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd", - "signature": "+7cEZBqjuIsu/Ape+2xNBw+5jqVmHPbOo21sP0MjlJG1SQJrYA1fIDX4BuwcUzS31R3qyC0nnvwQ2zRkZITBAQ==", - "hash": "0D58377496261505F48CF46359138349811D8F104DB6E8DAAE1BE3A845DD3620", + "signature": "7UXLMH3GXbROWUvKYxtWIepCds5iUfhFh/7R1hFJm0bYhPrXVdS39iiT/TvVjAxPlMX64fjCHuw7kMnJpQBIDA==", + "hash": "5A354E5304DD71757418621ADA2B3A7766706F4D837DE31C05EDE1F5C614AB08", "parameters": "", - "previousHash": "A46C0ED42C43C43769E98FB15C6CB050B2DDACBDB8A977010B4F77BF9D6BBD0D", + "previousHash": "2E3A789AFE1461B9CBE58A55EA47E6B7BE70938CC275AACE98283DF12B9C717F", "previousIssuer": "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd", - "inner_hash": "D5578A9FE63386D894599D8E6B814F05CA918D4C5C0882F32613E46C065C1DAA", + "inner_hash": "7253A5ACC95D3BB0FB467DFD8CE269C55F36F93AA218CAEF76E1480AC2F3D2F9", "dividend": 1263, "identities": [], "joiners": [], diff --git a/test/data/blocks.js b/test/data/blocks.js index fef13d0da5b7bf13cb63d81ef76a2daafc118dd2..dfaad7065c348a8d42561df78ab2b2eec1adb806 100644 --- a/test/data/blocks.js +++ b/test/data/blocks.js @@ -50,7 +50,7 @@ module.exports = { "IssuersFrame: 1\n" + "IssuersFrameVar: 0\n" + "DifferentIssuersCount: 0\n" + - "Parameters: 0.007376575:3600:120:0:40:604800:31536000:1:604800:604800:0.9:31536000:3:20:960:10:0.6666666666666666\n" + + "Parameters: 0.007376575:3600:120:0:40:604800:31536000:1:604800:604800:0.9:31536000:3:20:960:10:0.6666666666666666:1483614905:1483614905:100\n" + "MembersCount: 2\n" + "Identities:\n" + "DNann1Lh55eZMEDXeYt59bzHbA3NJR46DeQYCS2qQdLV:1eubHHbuNfilHMM0G2bI30iZzebQ2cQ1PC7uPAw08FGMMmQCRerlF/3pc4sAcsnexsxBseA/3lY03KlONqJBAg==:0-E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855:tic\n" + @@ -66,7 +66,7 @@ module.exports = { "DKpQPUL4ckzXYdnDRvCRKAm1gNvSdmAXnTrJZ7LvM5Qo:DNann1Lh55eZMEDXeYt59bzHbA3NJR46DeQYCS2qQdLV:0:vMaYgBSnU+83AYOVQCZAx1XLpg/F1MmMztDfCnZvl8hPs4LE9tcDvCrrFogAwMEW2N7Y0gCH62/fBMgw4KrGCA==\n" + "DNann1Lh55eZMEDXeYt59bzHbA3NJR46DeQYCS2qQdLV:DKpQPUL4ckzXYdnDRvCRKAm1gNvSdmAXnTrJZ7LvM5Qo:0:RKIGMgYIhB9FmjPbmyo4egPufg/iTpBznYGZp5hjK1WZ1a9imQldLNUMe0eiPlSKJTK/JD3gOlCiynOEY2csBA==\n" + "Transactions:\n" + - "InnerHash: 85EAAFF16565A526F5E7DD2E75E91F2D87BBD00BE30FBC2081BC855F76C93AFB\n" + + "InnerHash: 7A4E76A9A3410594AC9AED94B14AD9892426D76EDAF735CFE6C66432E422A63F\n" + "Nonce: 300000000001\n" + "WJourHkd6NnMxKDSEfrsiB7qE0mGbiFHSwy0cE8/q/is6hTd0mzlMNBPxDhoPkAiocfXJrQuIVeG0/ygxQrTBw==\n", @@ -147,7 +147,7 @@ module.exports = { "IssuersFrame: 100\n" + "IssuersFrameVar: 0\n" + "DifferentIssuersCount: 3\n" + - "Parameters: 0.7376575:100:157680000:0:40:7200:31536000:1:1000:1000:0.9:31536000:3:1:60:10:0.67\n" + + "Parameters: 0.7376575:100:157680000:0:40:7200:31536000:1:1000:1000:0.9:31536000:3:1:60:10:0.67:1511776000:1511776000:1511776000\n" + "MembersCount: 3\n" + "Identities:\n" + "Joiners:\n" + diff --git a/test/fast/block/protocol-brg107-udEffectiveTime.js b/test/fast/block/protocol-brg107-udEffectiveTime.js new file mode 100644 index 0000000000000000000000000000000000000000..f5fd8e1b87dfd74de4a5558c91e0f31cc5323094 --- /dev/null +++ b/test/fast/block/protocol-brg107-udEffectiveTime.js @@ -0,0 +1,40 @@ +"use strict"; +const co = require('co'); +const should = require('should'); +const indexer = require('../../../app/lib/dup/indexer'); + +describe("Protocol BR_G107 - udReevalTime", function(){ + + it('root block good udReevalTime', () => co(function*(){ + const conf = { udReevalTime0: 1500000000 }; + const HEAD_1 = null; + const HEAD = { number: 0 }; + indexer.prepareUDTime(HEAD, HEAD_1, conf); + HEAD.udReevalTime.should.equal(conf.udReevalTime0); + })); + + it('block with medianTime < udReevalTime', () => co(function*(){ + const conf = { dt: 100, dtReeval: 20 }; + const HEAD_1 = { number: 59, udReevalTime: 1500000900 }; + const HEAD = { number: 60, medianTime: 1500000899 }; + indexer.prepareUDTime(HEAD, HEAD_1, conf); + HEAD.udReevalTime.should.equal(HEAD_1.udReevalTime); + })); + + it('block with medianTime == udReevalTime', () => co(function*(){ + const conf = { dt: 100, dtReeval: 20 }; + const HEAD_1 = { number: 59, udReevalTime: 1500000900 }; + const HEAD = { number: 60, medianTime: 1500000900 }; + indexer.prepareUDTime(HEAD, HEAD_1, conf); + HEAD.udReevalTime.should.equal(HEAD_1.udReevalTime + conf.dtReeval); + })); + + it('block with medianTime > udReevalTime', () => co(function*(){ + const conf = { dt: 100, dtReeval: 20 }; + const HEAD_1 = { number: 59, udReevalTime: 1500000900 }; + const HEAD = { number: 60, medianTime: 1500000901 }; + indexer.prepareUDTime(HEAD, HEAD_1, conf); + HEAD.udReevalTime.should.equal(HEAD_1.udReevalTime + conf.dtReeval); + })); + +}); diff --git a/test/fast/block/protocol-brg11-udTime.js b/test/fast/block/protocol-brg11-udTime.js new file mode 100644 index 0000000000000000000000000000000000000000..41d1b463438118f3031c6d98a20ac68f2cf9855f --- /dev/null +++ b/test/fast/block/protocol-brg11-udTime.js @@ -0,0 +1,40 @@ +"use strict"; +const co = require('co'); +const should = require('should'); +const indexer = require('../../../app/lib/dup/indexer'); + +describe("Protocol BR_G11 - udTime", function(){ + + it('root block good udTime', () => co(function*(){ + const conf = { udTime0: 1500000000 }; + const HEAD_1 = null; + const HEAD = { number: 0 }; + indexer.prepareUDTime(HEAD, HEAD_1, conf); + HEAD.udTime.should.equal(conf.udTime0); + })); + + it('block with medianTime < udTime', () => co(function*(){ + const conf = { dt: 100 }; + const HEAD_1 = { number: 59, udTime: 1500000900 }; + const HEAD = { number: 60, medianTime: 1500000899 }; + indexer.prepareUDTime(HEAD, HEAD_1, conf); + HEAD.udTime.should.equal(HEAD_1.udTime); + })); + + it('block with medianTime == udTime', () => co(function*(){ + const conf = { dt: 100 }; + const HEAD_1 = { number: 59, udTime: 1500000900 }; + const HEAD = { number: 60, medianTime: 1500000900 }; + indexer.prepareUDTime(HEAD, HEAD_1, conf); + HEAD.udTime.should.equal(HEAD_1.udTime + conf.dt); + })); + + it('block with medianTime > udTime', () => co(function*(){ + const conf = { dt: 100 }; + const HEAD_1 = { number: 59, udTime: 1500000900 }; + const HEAD = { number: 60, medianTime: 1500000901 }; + indexer.prepareUDTime(HEAD, HEAD_1, conf); + HEAD.udTime.should.equal(HEAD_1.udTime + conf.dt); + })); + +}); diff --git a/test/fast/block/protocol-brg13-dividend.js b/test/fast/block/protocol-brg13-dividend.js new file mode 100644 index 0000000000000000000000000000000000000000..fb2bedf1ec972ad7db405b7094aed3eed867c4a8 --- /dev/null +++ b/test/fast/block/protocol-brg13-dividend.js @@ -0,0 +1,47 @@ +"use strict"; +const co = require('co'); +const should = require('should'); +const indexer = require('../../../app/lib/dup/indexer'); + +describe("Protocol BR_G13 - dividend", function(){ + + it('root block has no dividend', () => co(function*(){ + const conf = { udTime0: 1500000000, dt: 100 }; + const HEAD_1 = null; + const HEAD = { number: 0 }; + indexer.prepareUDTime(HEAD, HEAD_1, conf); + indexer.prepareDividend(HEAD, HEAD_1, conf); + should.equal(HEAD.dividend, null); + })); + + it('block with medianTime < udTime has no dividend', () => co(function*(){ + const conf = { dt: 100 }; + const HEAD_1 = { number: 59, udTime: 1500000900 }; + const HEAD = { number: 60, medianTime: 1500000899 }; + indexer.prepareUDTime(HEAD, HEAD_1, conf); + indexer.prepareDividend(HEAD, HEAD_1, conf); + HEAD.udTime.should.equal(HEAD_1.udTime); + should.equal(HEAD.dividend, null); + })); + + it('block with medianTime == udTime', () => co(function*(){ + const conf = { dt: 100, c: 0.0488 }; + const HEAD_1 = { number: 59, udTime: 1500000900, udReevalTime: 1500000900, dividend: 100, mass: 18000, unitBase: 1 }; + const HEAD = { number: 60, medianTime: 1500000900, membersCount: 3 }; + indexer.prepareUDTime(HEAD, HEAD_1, conf); + indexer.prepareDividend(HEAD, HEAD_1, conf); + HEAD.udTime.should.equal(HEAD_1.udTime + conf.dt); + should.equal(HEAD.dividend, 102); + })); + + it('block with medianTime > udTime', () => co(function*(){ + const conf = { dt: 100, c: 0.0488 }; + const HEAD_1 = { number: 59, udTime: 1500000900, udReevalTime: 1500000900, dividend: 100, mass: 18000, unitBase: 1 }; + const HEAD = { number: 60, medianTime: 1500000901, membersCount: 3 }; + indexer.prepareUDTime(HEAD, HEAD_1, conf); + indexer.prepareDividend(HEAD, HEAD_1, conf); + HEAD.udTime.should.equal(HEAD_1.udTime + conf.dt); + should.equal(HEAD.dividend, 102); + })); + +}); diff --git a/test/integration/crosschain-test.js b/test/integration/crosschain-test.js index c7d419702255c4b49942d30ce44666776a94acb1..4a4c38d686e07278e2ac5b010bd09beb492e429b 100644 --- a/test/integration/crosschain-test.js +++ b/test/integration/crosschain-test.js @@ -25,7 +25,8 @@ describe("Crosschain transactions", function() { httpLogs: true, forksize: 3, dt: 1, ud0: 120, rootoffset: 10, - sigQty: 1 + sigQty: 1, + udTime0: now + 1 }; describe('Successfull transaction', () => { diff --git a/test/integration/server-sandbox.js b/test/integration/server-sandbox.js index e6dc5d9e1dbf485892a0d20ee9de6f9ae2e9a942..cda5dc3c273c2acd191aaa173a7e1fdfb0ffc91e 100644 --- a/test/integration/server-sandbox.js +++ b/test/integration/server-sandbox.js @@ -8,11 +8,14 @@ const commit = require('./tools/commit'); const toolbox = require('./tools/toolbox'); const constants = require('../../app/lib/constants'); +const now = 1482300000; + const s1 = toolbox.server({ idtyWindow: 10, sigWindow: 10, msWindow: 10, dt: 10, + udTime0: now + 1, pair: { pub: 'HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd', sec: '51w4fEShBk1jCMauWu4mLpmDVfHksKmWcygpxriqCEZizbtERA6de4STKRkQBpxmMUwsKXRjSzuQ8ECwmqN1u2DP' @@ -53,8 +56,6 @@ const i14 = user('i14', { pub: 'H9dtBFmJohAwMNXSbfoL6xfRtmrqMw8WZnjXMHr4vEHX', s describe("Sandboxes", function() { - const now = 1482300000; - before(() => co(function*() { yield s1.initWithDAL().then(bma).then((bmapi) => bmapi.openConnections()); diff --git a/test/integration/tests.js b/test/integration/tests.js index 7e81633d69fad4d70629a53942c9bc1b514aab7b..509cc582899aa86deb8fd8b58990808e7a8f7c34 100644 --- a/test/integration/tests.js +++ b/test/integration/tests.js @@ -17,6 +17,8 @@ const rp = require('request-promise'); const expectAnswer = httpTest.expectAnswer; const MEMORY_MODE = true; +require('duniter-bma').duniter.methods.noLimit(); // Disables the HTTP limiter + describe("Integration", function() { describe("Node 1", function() { diff --git a/test/integration/transactions-chaining.js b/test/integration/transactions-chaining.js index de951f88485cb129d05fd9451957d51e2c60c7fa..02ee9ce64b9c0547d187ad563198c32e964b23db 100644 --- a/test/integration/transactions-chaining.js +++ b/test/integration/transactions-chaining.js @@ -22,6 +22,7 @@ describe("Transaction chaining", function() { sec: '468Q1XtTq7h84NorZdWBZFJrGkB18CbmbHr9tkp9snt5GiERP7ySs3wM8myLccbAAGejgMRC9rqnXuW3iAfZACm7' }, dt: 3600, + udTime0: now + 3600, ud0: 1200, c: 0.1 }); diff --git a/test/integration/v0.4-dividend.js b/test/integration/v0.4-dividend.js index 4cd821459504f1bcd9bd84c5589f701cf4cf21ad..01f1fe6bb5d33bccb3333fb870d5c58f8f9bce7b 100644 --- a/test/integration/v0.4-dividend.js +++ b/test/integration/v0.4-dividend.js @@ -7,21 +7,25 @@ const user = require('./tools/user'); const commit = require('./tools/commit'); const toolbox = require('./tools/toolbox'); +const now = 1484000000; + const s1 = toolbox.server({ c: 0.1, dt: 10, + udTime0: now + 10, + udReevalTime0: now + 10, ud0: 100, pair: { pub: 'HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd', sec: '51w4fEShBk1jCMauWu4mLpmDVfHksKmWcygpxriqCEZizbtERA6de4STKRkQBpxmMUwsKXRjSzuQ8ECwmqN1u2DP' - } + }, + medianTimeBlocks: 1 }); const cat = user('cat', { pub: 'HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd', sec: '51w4fEShBk1jCMauWu4mLpmDVfHksKmWcygpxriqCEZizbtERA6de4STKRkQBpxmMUwsKXRjSzuQ8ECwmqN1u2DP'}, { server: s1 }); const tac = user('tac', { pub: '2LvDg21dVXvetTD9GdkPLURavLYEqP3whauvPWX4c2qc', sec: '2HuRLWgKgED1bVio1tdpeXrf7zuUszv1yPHDsDj7kcMC4rVSN9RC58ogjtKNfTbH1eFz7rn38U1PywNs3m6Q7UxE'}, { server: s1 }); const tic = user('tic', { pub: 'DNann1Lh55eZMEDXeYt59bzHbA3NJR46DeQYCS2qQdLV', sec: '468Q1XtTq7h84NorZdWBZFJrGkB18CbmbHr9tkp9snt5GiERP7ySs3wM8myLccbAAGejgMRC9rqnXuW3iAfZACm7'}, { server: s1 }); -const now = 1484000000; describe("Protocol 0.4 Dividend", function() { @@ -36,16 +40,16 @@ describe("Protocol 0.4 Dividend", function() { yield cat.join(); yield tac.join(); yield s1.commit({ time: now }); - yield s1.commit({ time: now + 5000 }); - yield s1.commit({ time: now + 5000 }); - yield s1.commit({ time: now + 5000 }); + yield s1.commit({ time: now + 10 }); + yield s1.commit({ time: now + 10 * 2 }); + yield s1.commit({ time: now + 10 * 3 }); // tic joins yield tic.createIdentity(); yield cat.cert(tic); yield tic.join(); - yield s1.commit({ time: now + 5000 }); - yield s1.commit({ time: now + 5000 }); + yield s1.commit({ time: now + 10 + 10 * 4 }); + yield s1.commit({ time: now + 10 + 10 * 5 }); })); it('should exit 2 dividends for cat', () => s1.expect('/tx/sources/HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd', (res) => { diff --git a/test/integration/v1.0-double-dividend.js b/test/integration/v1.0-double-dividend.js new file mode 100644 index 0000000000000000000000000000000000000000..7781c7df96c66430a2c4db4330e6c4c2bf4c606d --- /dev/null +++ b/test/integration/v1.0-double-dividend.js @@ -0,0 +1,87 @@ +"use strict"; + +const co = require('co'); +const should = require('should'); +const bma = require('duniter-bma').duniter.methods.bma; +const constants = require('../../app/lib/constants'); +const toolbox = require('./tools/toolbox'); + +const now = 1480000000; + +const conf = { + ud0: 1000, + udTime0: now + 4, // Delay first UD recomputation to +20 + udReevalTime0: now + 12, // Delay first UD recomputation to +20 + c: .0488, + dt: 2, + dtReeval: 10, // => create 5 dividends of 200 + medianTimeBlocks: 1 // The medianTime always equals previous block's medianTime +}; + +constants.CORES_MAXIMUM_USE_IN_PARALLEL = 1; +constants.NB_DIGITS_UD = 4; + +let s1, cat, tac; + +describe("Protocol 1.0 Dividend Update", function() { + + /***** + * DESCRIPTION + * ----------- + * + * The dividend is computed over 2 main variables: + * + * * main step dividend: this is a theoretical dividend + * * effective dividend: this is the real dividend, which is a share of the theoretical one + */ + + before(() => co(function*() { + + const res1 = yield toolbox.simpleNodeWith2Users(conf); + s1 = res1.s1; + cat = res1.cat; // HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd + tac = res1.tac; // 2LvDg21dVXvetTD9GdkPLURavLYEqP3whauvPWX4c2qc + yield s1.commit({ time: now }); + yield s1.commit({ time: now + 3 }); + yield s1.commit({ time: now + 4 }); + yield s1.commit({ time: now + 5 }); + yield s1.commit({ time: now + 6 }); + yield s1.commit({ time: now + 8 }); + yield s1.commit({ time: now + 10 }); + yield s1.commit({ time: now + 12 }); + yield s1.commit({ time: now + 14 }); + yield s1.commit({ time: now + 16 }); + })); + + it('should have block#2 with no UD', () => s1.expectThat('/blockchain/block/2', (json) => { + should.not.exist(json.dividend); + })); + + it('should have block#3 with UD 1000', () => s1.expectThat('/blockchain/block/3', (json) => { + json.dividend.should.equal(1000); + })); + + it('should have block#4 with no UD', () => s1.expectThat('/blockchain/block/4', (json) => { + should.not.exist(json.dividend); + })); + + it('should have block#5 with UD 1000', () => s1.expectThat('/blockchain/block/5', (json) => { + json.dividend.should.equal(1000); + })); + + it('should have block#6 with UD 1000', () => s1.expectThat('/blockchain/block/6', (json) => { + json.dividend.should.equal(1000); + })); + + it('should have block#7 with UD 1000', () => s1.expectThat('/blockchain/block/7', (json) => { + json.dividend.should.equal(1000); + })); + + it('should have block#8 with UD 1010', () => s1.expectThat('/blockchain/block/8', (json) => { + json.dividend.should.equal(1010); + })); + + it('should have block#9 with UD 1010', () => s1.expectThat('/blockchain/block/9', (json) => { + json.dividend.should.equal(1010); + })); +}); diff --git a/test/integration/v1.0-g1-dividend.js b/test/integration/v1.0-g1-dividend.js new file mode 100644 index 0000000000000000000000000000000000000000..979dff6970174b9a02bbae8d1f527a5174e4750e --- /dev/null +++ b/test/integration/v1.0-g1-dividend.js @@ -0,0 +1,92 @@ +"use strict"; + +const co = require('co'); +const should = require('should'); +const bma = require('duniter-bma').duniter.methods.bma; +const constants = require('../../app/lib/constants'); +const toolbox = require('./tools/toolbox'); + +const start = 1489057200; // 2016-03-09 12:00:00 UTC+0 + +const aDay = 3600 * 24; +const _6months = 15778800; + +const conf = { + ud0: 1000, + udTime0: 1489143600, // 2016-03-10 12:00:00 UTC+0 + udReevalTime0: 1490094000, // 2016-03-21 12:00:00 UTC+0 ==> first recomputed UD (equinox) + c: .0488, // 4.88 % + dt: aDay, + dtReeval: _6months, // 6 months + medianTimeBlocks: 1, // The medianTime always equals previous block's medianTime for easy testing + avgGenTime: 3600 * 24 // 1 bloc a day +}; + +constants.CORES_MAXIMUM_USE_IN_PARALLEL = 1; + +let s1, cat, tac; + +describe("Protocol 1.0 Ğ1 Dividend", function() { + + /***** + * DESCRIPTION + * ----------- + * + * Simulates the real dividends that would occur in the currency (simulating N) + */ + + before(() => co(function*() { + + const res1 = yield toolbox.simpleNodeWith2Users(conf); + s1 = res1.s1; + cat = res1.cat; // HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd + tac = res1.tac; // 2LvDg21dVXvetTD9GdkPLURavLYEqP3whauvPWX4c2qc + for (let i = 0; i < 15; i++) { + yield s1.commit({ time: start + aDay * i }); + } + })); + + it('should have block#0 has no UD', () => s1.expectThat('/blockchain/block/0', (json) => { + should.not.exist(json.dividend); + json.should.have.property('medianTime').equal(start); // 2016-03-09 12:00:00 UTC+0 + })); + + it('should have block#1 has no UD', () => s1.expectThat('/blockchain/block/1', (json) => { + should.not.exist(json.dividend); + json.should.have.property('medianTime').equal(start); // 2016-03-09 12:00:00 UTC+0 + })); + + it('should have block#2 with UD 1000', () => s1.expectThat('/blockchain/block/2', (json) => { + json.dividend.should.equal(1000); + json.should.have.property('medianTime').equal(start + aDay); // 2016-03-10 12:00:00 UTC+0 + })); + + it('should have block#3 with UD 1000', () => s1.expectThat('/blockchain/block/3', (json) => { + json.dividend.should.equal(1000); + json.should.have.property('medianTime').equal(start + aDay * 2); // 2016-03-11 12:00:00 UTC+0 + })); + + it('should have block#4 with UD 1000', () => s1.expectThat('/blockchain/block/4', (json) => { + json.dividend.should.equal(1000); + })); + + it('should have block#11 with UD 1000', () => s1.expectThat('/blockchain/block/11', (json) => { + json.dividend.should.equal(1000); + json.should.have.property('medianTime').equal(start + aDay * 10); // 2016-03-19 12:00:00 UTC+0 + })); + + it('should have block#12 with UD 1000', () => s1.expectThat('/blockchain/block/12', (json) => { + json.dividend.should.equal(1000); + json.should.have.property('medianTime').equal(start + aDay * 11); // 2016-03-19 12:00:00 UTC+0 + })); + + it('should have block#13 with UD 1027', () => s1.expectThat('/blockchain/block/13', (json) => { + json.dividend.should.equal(1027); + json.should.have.property('medianTime').equal(start + aDay * 12); // 2016-03-21 12:00:00 UTC+0 + })); + + it('should have block#14 with UD 1027', () => s1.expectThat('/blockchain/block/14', (json) => { + json.dividend.should.equal(1027); + json.should.have.property('medianTime').equal(start + aDay * 13); // 2016-03-21 12:00:00 UTC+0 + })); +}); diff --git a/test/integration/v1.0-source-garbaging.js b/test/integration/v1.0-source-garbaging.js index 017cbeea8552a9d8bedf8cea15bc16ad43c8f9b9..2b88a2448f5dd18174c37398a32f3dcd842c85b0 100644 --- a/test/integration/v1.0-source-garbaging.js +++ b/test/integration/v1.0-source-garbaging.js @@ -6,16 +6,18 @@ const bma = require('duniter-bma').duniter.methods.bma; const constants = require('../../app/lib/constants'); const toolbox = require('./tools/toolbox'); +const now = 1480000000; + const conf = { ud0: 9995, c: .99, dt: 300, + udTime0: now + 300, + udReevalTime0: now + 300, avgGenTime: 5000, medianTimeBlocks: 1 // The medianTime always equals previous block's medianTime }; -const now = 1480000000; - constants.CORES_MAXIMUM_USE_IN_PARALLEL = 1; constants.NB_DIGITS_UD = 4; @@ -65,14 +67,14 @@ describe("Protocol 1.0 Source Garbaging", function() { yield s1.commit({ time: now + 300 }); yield s1.expectThat('/tx/sources/HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd', (json) => { json.sources.should.deepEqual([ - { type: 'T', noffset: 1, identifier: '0DD9901D4AC08B8F77584F2AA86235873D095C071361A4419949C1F41634AD71', amount: 6995, base: 0 } + { type: 'T', noffset: 1, identifier: '50844926EC611BF6BBF9918A657F87E0AA0DE5A5D8DB3D476289BF64C6ED8C25', amount: 6995, base: 0 } ]); }); yield s1.expectThat('/tx/sources/2LvDg21dVXvetTD9GdkPLURavLYEqP3whauvPWX4c2qc', (json) => { json.sources.should.deepEqual([ { type: 'D', noffset: 2, identifier: '2LvDg21dVXvetTD9GdkPLURavLYEqP3whauvPWX4c2qc', amount: 9995, base: 0 }, - { type: 'T', noffset: 0, identifier: '05339B305C93BCFD000DD0578EED8D8C1B1884525E669A90C471DDE431628BCA', amount: 2999, base: 0 }, - { type: 'T', noffset: 0, identifier: '0DD9901D4AC08B8F77584F2AA86235873D095C071361A4419949C1F41634AD71', amount: 1, base: 0 } + { type: 'T', noffset: 0, identifier: 'E84C72FBE788F6F52B293676A8314A6F227F14B0A8FD0168E1C4F08E85D1F8E9', amount: 2999, base: 0 }, + { type: 'T', noffset: 0, identifier: '50844926EC611BF6BBF9918A657F87E0AA0DE5A5D8DB3D476289BF64C6ED8C25', amount: 1, base: 0 } ]); }); })); @@ -82,15 +84,15 @@ describe("Protocol 1.0 Source Garbaging", function() { yield s1.commit({ time: now + 300 }); yield s1.expectThat('/tx/sources/HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd', (json) => { json.sources.should.deepEqual([ - { type: 'T', noffset: 1, identifier: '03E54C10B62FC39558D1743CA130AFF9A172CD8485FDA6BAD7FA50421A456F4C', amount: 1500, base: 0 } + { type: 'T', noffset: 1, identifier: 'DA453C8B6300F06AC538D7EFB154DA9AE51F30D525236B9D4AD13944E18AA1B0', amount: 1500, base: 0 } ]); }); yield s1.expectThat('/tx/sources/2LvDg21dVXvetTD9GdkPLURavLYEqP3whauvPWX4c2qc', (json) => { json.sources.should.deepEqual([ { type: 'D', noffset: 2, identifier: '2LvDg21dVXvetTD9GdkPLURavLYEqP3whauvPWX4c2qc', amount: 9995, base: 0 }, - { type: 'T', noffset: 0, identifier: '05339B305C93BCFD000DD0578EED8D8C1B1884525E669A90C471DDE431628BCA', amount: 2999, base: 0 }, - { type: 'T', noffset: 0, identifier: '0DD9901D4AC08B8F77584F2AA86235873D095C071361A4419949C1F41634AD71', amount: 1, base: 0 }, - { type: 'T', noffset: 0, identifier: '03E54C10B62FC39558D1743CA130AFF9A172CD8485FDA6BAD7FA50421A456F4C', amount: 5495, base: 0 } + { type: 'T', noffset: 0, identifier: 'E84C72FBE788F6F52B293676A8314A6F227F14B0A8FD0168E1C4F08E85D1F8E9', amount: 2999, base: 0 }, + { type: 'T', noffset: 0, identifier: '50844926EC611BF6BBF9918A657F87E0AA0DE5A5D8DB3D476289BF64C6ED8C25', amount: 1, base: 0 }, + { type: 'T', noffset: 0, identifier: 'DA453C8B6300F06AC538D7EFB154DA9AE51F30D525236B9D4AD13944E18AA1B0', amount: 5495, base: 0 } ]); }); })); @@ -98,28 +100,28 @@ describe("Protocol 1.0 Source Garbaging", function() { it('should be able to lose money by sending 1,99,100,999,1000,300+700 units to random accounts', () => co(function*() { yield s1.expectThat('/tx/sources/HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd', (json) => { json.sources.should.deepEqual([ - { type: 'T', noffset: 1, identifier: '03E54C10B62FC39558D1743CA130AFF9A172CD8485FDA6BAD7FA50421A456F4C', amount: 1500, base: 0 } + { type: 'T', noffset: 1, identifier: 'DA453C8B6300F06AC538D7EFB154DA9AE51F30D525236B9D4AD13944E18AA1B0', amount: 1500, base: 0 } ]); }); yield cat.sendP(1, '6EQoFVnFf2xpaRzieNTXmAKU6XkDHYrvgorJ8ppMFa8b'); yield s1.commit({ time: now + 300 }); yield s1.expectThat('/tx/sources/HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd', (json) => { json.sources.should.deepEqual([ - { type: 'T', noffset: 1, identifier: 'F260D0403BCF49812C5002324E096A19B725D922F654DB31F0F144C830E10380', amount: 1499, base: 0 } + { type: 'T', noffset: 1, identifier: 'A6F2C3DFF8EFEBE226F103E86193A8F22A51D25DD63C2BB9BF86D9A5F3DC55B8', amount: 1499, base: 0 } ]); }); yield cat.sendP(99, '2EvWF9XM6TY3zUDjwi3qfGRW5zhN11TXcUDXdgK2XK41'); yield s1.commit({ time: now + 300 }); yield s1.expectThat('/tx/sources/HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd', (json) => { json.sources.should.deepEqual([ - { type: 'T', noffset: 1, identifier: '217ACD8A6D98DBB38D8C8C6C8A930049933A09B2D7283501BD61857506351875', amount: 1400, base: 0 } + { type: 'T', noffset: 1, identifier: 'F1C86F38F33B2D37561EE927801D8B630BCADA62336E4BBC718BA06B1101584C', amount: 1400, base: 0 } ]); }); yield cat.sendP(100, 'DPFgnVSB14QnYFjKNhbFRYLxroSmaXZ53TzgFZBcCxbF'); yield s1.commit({ time: now + 300 }); yield s1.expectThat('/tx/sources/HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd', (json) => { json.sources.should.deepEqual([ - { type: 'T', noffset: 1, identifier: 'CA4817B83983AE92075B9A777C9DAED80CF07A0B2343E78ECA368D1FD342E8FC', amount: 1300, base: 0 } + { type: 'T', noffset: 1, identifier: '0FAD3D25899C789C1C2B12FE3D90BF26E5794FB31ECF5072A881DF9B83E7CA00', amount: 1300, base: 0 } ]); }); yield tac.sendP(4, 'HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd'); @@ -127,8 +129,8 @@ describe("Protocol 1.0 Source Garbaging", function() { yield s1.commit({ time: now + 300 }); yield s1.expectThat('/tx/sources/HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd', (json) => { json.sources.should.deepEqual([ - { type: 'T', noffset: 1, identifier: '985B74A888072D26C2E4B31DA611C3C7BA8BF5BB3F9677F1796F0F97B2BA9620', amount: 301, base: 0 }, - { type: 'T', noffset: 0, identifier: 'CACBD70FC07A122108A8C0798EF43E9D016065210B25C8554560BDED0E4D0B88', amount: 4, base: 0 } + { type: 'T', noffset: 0, identifier: '3B12EEC97704A8CCA31AFD7B60BA09555744703E22A6A47EE4ECBE6DA20B27E5', amount: 4, base: 0 }, + { type: 'T', noffset: 1, identifier: '9B18E2C2CBF9C856560E76F8684665C8677DD0506AAD5195960E30CC37A5706C', amount: 301, base: 0 } ]); }); yield cat.sendP(300, '7kMAi8wttYKPK5QSfCwoDriNTcCTWKzTbuSjsLsjGJX2'); @@ -149,20 +151,20 @@ describe("Protocol 1.0 Source Garbaging", function() { // Has just enough on the account (100 units) yield s1.expectThat('/tx/sources/DPFgnVSB14QnYFjKNhbFRYLxroSmaXZ53TzgFZBcCxbF', (json) => { json.sources.should.deepEqual([ - { type: 'T', noffset: 0, identifier: 'CA4817B83983AE92075B9A777C9DAED80CF07A0B2343E78ECA368D1FD342E8FC', amount: 100, base: 0 } + { type: 'T', noffset: 0, identifier: '0FAD3D25899C789C1C2B12FE3D90BF26E5794FB31ECF5072A881DF9B83E7CA00', amount: 100, base: 0 } ]); }); // Has way enough on the account (999 units) yield s1.expectThat('/tx/sources/4WmQWq4NuJtu6mzFDKkmmu6Cm6BZvgoY4b4MMDMwVvu7', (json) => { json.sources.should.deepEqual([ - { type: 'T', noffset: 0, identifier: '985B74A888072D26C2E4B31DA611C3C7BA8BF5BB3F9677F1796F0F97B2BA9620', amount: 999, base: 0 } + { type: 'T', noffset: 0, identifier: '9B18E2C2CBF9C856560E76F8684665C8677DD0506AAD5195960E30CC37A5706C', amount: 999, base: 0 } ]); }); // Has way enough on the account (300 + 700 units) yield s1.expectThat('/tx/sources/7kMAi8wttYKPK5QSfCwoDriNTcCTWKzTbuSjsLsjGJX2', (json) => { json.sources.should.deepEqual([ - { type: 'T', noffset: 0, identifier: '660E2783D1D52B10DDE425D7EDE13539ABBDF7407A8656B96540ED91D46A5F01', amount: 300, base: 0 }, - { type: 'T', noffset: 0, identifier: 'FCE87BC40052FFAF8CB72EFBBD698463B3407E080807667DAC7E6239FB531238', amount: 700, base: 0 } + { type: 'T', noffset: 0, identifier: '37CD105D17182155978798C773C70950470EBFB27B082F888B3423670F956F35', amount: 300, base: 0 }, + { type: 'T', noffset: 0, identifier: '6EF384807D1100D51BCCB9ED6E6FF4CA12CC1F4F30392CFD43746D4D1C4BC22E', amount: 700, base: 0 } ]); }); })); @@ -180,16 +182,16 @@ describe("Protocol 1.0 Source Garbaging", function() { // Has enough on the account (300x10^0 + 700x10^0 = 1000x10^0 = 100x10^1) yield s1.expectThat('/tx/sources/7kMAi8wttYKPK5QSfCwoDriNTcCTWKzTbuSjsLsjGJX2', (json) => { json.sources.should.deepEqual([ - { type: 'T', noffset: 0, identifier: '660E2783D1D52B10DDE425D7EDE13539ABBDF7407A8656B96540ED91D46A5F01', amount: 300, base: 0 }, - { type: 'T', noffset: 0, identifier: 'FCE87BC40052FFAF8CB72EFBBD698463B3407E080807667DAC7E6239FB531238', amount: 700, base: 0 } + { type: 'T', noffset: 0, identifier: '37CD105D17182155978798C773C70950470EBFB27B082F888B3423670F956F35', amount: 300, base: 0 }, + { type: 'T', noffset: 0, identifier: '6EF384807D1100D51BCCB9ED6E6FF4CA12CC1F4F30392CFD43746D4D1C4BC22E', amount: 700, base: 0 } ]); }); yield s1.commit({ time: now + 1800 }); // Has enough on the account (300x10^0 + 700x10^0 = 1000x10^0 = 100x10^1) yield s1.expectThat('/tx/sources/7kMAi8wttYKPK5QSfCwoDriNTcCTWKzTbuSjsLsjGJX2', (json) => { json.sources.should.deepEqual([ - { type: 'T', noffset: 0, identifier: '660E2783D1D52B10DDE425D7EDE13539ABBDF7407A8656B96540ED91D46A5F01', amount: 300, base: 0 }, - { type: 'T', noffset: 0, identifier: 'FCE87BC40052FFAF8CB72EFBBD698463B3407E080807667DAC7E6239FB531238', amount: 700, base: 0 } + { type: 'T', noffset: 0, identifier: '37CD105D17182155978798C773C70950470EBFB27B082F888B3423670F956F35', amount: 300, base: 0 }, + { type: 'T', noffset: 0, identifier: '6EF384807D1100D51BCCB9ED6E6FF4CA12CC1F4F30392CFD43746D4D1C4BC22E', amount: 700, base: 0 } ]); }); yield s1.commit({ time: now + 3600 });