diff --git a/lib/deterministicmnlist/QuorumEntry.js b/lib/deterministicmnlist/QuorumEntry.js index feb6004b0..3680d9aeb 100644 --- a/lib/deterministicmnlist/QuorumEntry.js +++ b/lib/deterministicmnlist/QuorumEntry.js @@ -366,6 +366,13 @@ QuorumEntry.getParams = function getParams(llmqType) { params.maximumActiveQuorumsCount = 2; return params; case constants.LLMQ_TYPES.LLMQ_TYPE_LLMQ_DEVNET: + // @todo needs to be removed after 18 upgrade + if (QuorumEntry.isCore17) { + params.size = 10; + params.threshold = 3; + params.maximumActiveQuorumsCount = 7; + return params; + } params.size = 12; params.threshold = 6; params.maximumActiveQuorumsCount = 4; @@ -566,6 +573,13 @@ QuorumEntry.prototype.calculateHash = function calculateHash() { return Hash.sha256sha256(this.toBufferForHashing()).reverse(); }; +/** + * @todo Remove after Core 18 upgrade + * + * @type {boolean} + */ +QuorumEntry.isCore17 = false; + /** * Creates a copy of QuorumEntry * @return {QuorumEntry} diff --git a/test/deterministicmnlist/SimplifiedMNList.integration.js b/test/deterministicmnlist/SimplifiedMNList.integration.js deleted file mode 100644 index 95428b429..000000000 --- a/test/deterministicmnlist/SimplifiedMNList.integration.js +++ /dev/null @@ -1,326 +0,0 @@ -/* eslint-disable */ - -const SimplifiedMNListDiff = require("../../lib/deterministicmnlist/SimplifiedMNListDiff"); -const SimplifiedMNList = require("../../lib/deterministicmnlist/SimplifiedMNList"); -const rawDiff = { - baseBlockHash: '6cddc5d028062c87d634119707a5b3c34ad357a6024c50c13e2adc6c2ad5658a', - blockHash: '000000c58d5f1bbd16ca845c1f7b34b8e73573b8e59df38da98ecc005c44c473', - cbTxMerkleTree: '01000000017cb212271572913ac4212141fcfff14203c7256d5a7b3dd118d39979cf95d8250101', - cbTx: '03000500010000000000000000000000000000000000000000000000000000000000000000ffffffff050258100101ffffffff020034e230040000001976a914d003f3dcc6aab717ff22c7cd3c4d4baaf873f46e88ac004e5349060000001976a914d003f3dcc6aab717ff22c7cd3c4d4baaf873f46e88ac00000000460200581000005a2599559c59733fe8eeb4affee92ab6303be89103d95de639831d37d7e1b517bf1c5e5e2716aadd0c3cc6e92d4c12277441f3038d96d4af750db5a6b42ec77e', - deletedMNs: [], - mnList: [ - { - proRegTxHash: 'b3b449f85213867385d6c5a82eeb222ca7cc7e09fd01b12ffd71aa73b4c5e740', - confirmedHash: '00000eefe1cedc451725cee0c13a9f00d00f161d7b763381540ca81794623c45', - service: '35.87.217.196:20001', - pubKeyOperator: '080308897b0f8c25ded96b35ca7ca407f8e3d35064367f4fdeea138d4adb00e8752793592b45ceead426b3d942e2abd9', - votingAddress: 'yVymvviPP5uXGux2BPeGJ1JrUpth7qsobR', - isValid: true, - }, - { - proRegTxHash: '1fd8fb7818ed7c07145243a6dc48ad568fb5eee4260c4df6e05455b7cd8d0103', - confirmedHash: '000008742811cd8b6bf14a9a4854e6bf50bbbfb8d709f4cb6fd35aee477b488b', - service: '34.220.177.21:20001', - pubKeyOperator: '1741dd3887d5f8add31f58fd654a09e65de89410d01ad46d5c5aee64ce2b5744877ecd68de253b54a0385abbcccbf9d5', - votingAddress: 'yaoo8UhCn6wxPCvSSTQSYyG32yt52sgh4b', - isValid: true, - }, - { - proRegTxHash: 'ff4fe5592cd19d23813650e020c8893588cd135e40988d9383a42fdd4373976e', - confirmedHash: '00000c9b1269dad2a786bacee0550e54664b035544e1ee2af91b7f8809196eab', - service: '54.213.1.8:20001', - pubKeyOperator: '05e4ee07715f404eb394fd69304e361607d857331c9b9a58185f53c1e1da3c873140e50d3f360a85190e2a1244bf32d0', - votingAddress: 'yLceJztHVZFbeqE9v86sLD9bDKFBmNqHQD', - isValid: true, - }, - { - proRegTxHash: '1358a4665b8fd6229f28816011d862562d6cc9dfd5a3236f37e73a1915acd7af', - confirmedHash: '00000aa210f9bad953717fdde614d04f707830ccafe1052c24ad170a71119d68', - service: '34.214.198.116:20001', - pubKeyOperator: '83b72dba724404a2cf69d08e3675cc8d27a2bc4afc51a5eb1553ed02453ab51b521196396fa32b429637931cede482d8', - votingAddress: 'yVuPNBwY5Pknftb9VEKb8EyQd45DPDcyaq', - isValid: true, - }, - { - proRegTxHash: '5afae9c55e3e54e78c19b13db84144c6c1e2119f72752bf8a44ab2e1c2e95cb0', - confirmedHash: '000017dd0692d81505aa11400ea923ff78935d9e6d099ed90d98326c1c1c8a59', - service: '54.190.97.111:20001', - pubKeyOperator: '97d0651efed006c1541a7cef3212183361a11250dbf74d5d54e552a5b26afbd432d184873c7c8480851836d7be0fcba7', - votingAddress: 'yi3gFgvXT6i249pQF1QkEBraDSJhcePMHj', - isValid: true, - }, - { - proRegTxHash: '631156b65a6d7a864c14d6221dea15485cd23ab4c31770ff0d10faafa03f0991', - confirmedHash: '000000599a95922a5ade6dcf89cb3abb29a0bb5412e03fe715d245471dd8dbe0', - service: '35.86.246.238:20001', - pubKeyOperator: '81a2e6169c3f49275041a54ad6efb118aa3a588b6d369e2725373a8603cb38557869fcf8b337dc835f349b32bfa2ec6f', - votingAddress: 'yNuSyvkFxZPdsGJKgReQR6mnNjE8x5JJMk', - isValid: true, - }, - { - proRegTxHash: '00731413f31cd3d72778c2ea04566effd4bf3034f6ec99098f1f87d1e5e402d2', - confirmedHash: '000000599a95922a5ade6dcf89cb3abb29a0bb5412e03fe715d245471dd8dbe0', - service: '35.89.88.110:20001', - pubKeyOperator: '9707a3a9c840fc19a0f2c13720e1fd1df890e2866bf415175ffb897500accb0235149a117096e4b7a0cefae8ec47f023', - votingAddress: 'ygq6DTRxEr3B3SC4aJYC5jqqnAyxaQpU74', - isValid: true, - }, - { - proRegTxHash: 'd5dd37f1f8e9aa996c760a762da180a58339f6899bb8a31b33fe6338f2601035', - confirmedHash: '0000050eacac01cbc8bcd1975384192aa5deeaf0c57994f9761bb7df97d738a5', - service: '34.219.34.135:20001', - pubKeyOperator: '17e8f04d989f8c9187c8fcedee7e38dc98876ba21f3a1576854aae6bb9c58f5bbcb4089db9a77cc7d2d8e10462e14530', - votingAddress: 'yc1TGAi1eivpAv7DsSnExingdVbWchXQBz', - isValid: true, - }, - { - proRegTxHash: 'e7310f2e45b53b4978b462391f58d9a946e5a144ae0af3a95a65ffaa85e33c36', - confirmedHash: '000015dd56ef887e9933a762036fb1f189274b1fcaec291a130df19a93c106ca', - service: '54.188.184.73:20001', - pubKeyOperator: '88cf2a42b265e7d3a6af578884a273b0efbd4f28362fdc70e7e2668268584d2c74e889a1fa92b46cb2b00ebe3a0f97fb', - votingAddress: 'yMDHEJNJyD3t6MBvMwkuDcQaoUD5e7oVYL', - isValid: true, - }, - { - proRegTxHash: 'e0580f708ebfac01db837b508601ab842d56554f197967be6d0c95f0b96141b7', - confirmedHash: '00000a214abf96270ec652b15369b9c1d7bf8735a8d8a0c153a3362fe009b6ef', - service: '34.208.73.244:20001', - pubKeyOperator: '17cda5de4c6d1513dd1472bb15116f900a9608087f2140dbef3b1ff063c864dafed97cd11a13997763c69b0b520b6f62', - votingAddress: 'yjWZY4tDUGRrAajH8rr2kiTLBHJcjjzUZB', - isValid: true, - }, - { - proRegTxHash: 'd68858b95ad0fe08729fff7ad50a92d4f4a736aa5015484a8edfa03dcdb26d78', - confirmedHash: '0000155575c7d6761f13261c58a764186a3db72966d34681b52f62e03080a9f8', - service: '35.162.226.158:20001', - pubKeyOperator: '95690067658db6ff92c2e187fd040226978ec8a59e6ca76ed0c84cd48e588f173a8f67458e1250be504c6c8ead2ea7f7', - votingAddress: 'yVbg4E2rownEjEUdeb2shARL3VTJPLBN4J', - isValid: true, - }, - { - proRegTxHash: '3a70a9324bfafe604ba19d998f9b29a072eda8998372b6692a1520b229917b59', - confirmedHash: '00002b1758c08c6ec9910a6b7847ee876774b42f0bf3cef892b604f2df64f70e', - service: '54.70.158.196:20001', - pubKeyOperator: '8e61d40a7affaaae1dc8afcf45ac1dd875debeea124b3191974b417237d4f8b3329cc3e9800a7297cdcbc9f2321fe165', - votingAddress: 'yQn6gqFso8sDr5WtrCuJkKt1bda8z87GS3', - isValid: true, - }, - { - proRegTxHash: 'e8df3edc6d3314618fbf50a3efa01faa8cc31688a3aa612ab1bf794c6c3ccb1c', - confirmedHash: '000024bf48e6260ec57e7cd189a7f8ef135716fafc3b2b6a9cde7c21ec89e752', - service: '54.213.80.112:20001', - pubKeyOperator: '9580bcd65d587306a583ee47d9387ca40d4be2b7a2e7a0c9852faa3019de4b4672982a276e88fdb106da80a67b3e9c71', - votingAddress: 'yjdSeNNs6pc4AQ26qpLD98mgukcmgjWoPw', - isValid: true, - }, - { - proRegTxHash: '09dd7f07b9d3eb6df74307fdb9abbef42cb14948bc1daaeb1a1326fd7c33dffd', - confirmedHash: '00000aa210f9bad953717fdde614d04f707830ccafe1052c24ad170a71119d68', - service: '35.89.93.192:20001', - pubKeyOperator: '9501395531b856dac937dd52b086288c33433ce4e51962574138f93436a127d9fe078b7d7e3937f56e5d0384c5b7e1be', - votingAddress: 'yexFZ64u6snNR4JPuCffyJpsxZQsLAbJ8S', - isValid: true, - }, - { - proRegTxHash: 'e8982ae45473793211756b10d3ab7a3e13e54f9f3097e3074876216fd9fac99e', - confirmedHash: '000008742811cd8b6bf14a9a4854e6bf50bbbfb8d709f4cb6fd35aee477b488b', - service: '35.87.26.233:20001', - pubKeyOperator: '0cc4a8021c28d9ac15092fb191e6e2abf59c5e172827671f3ad1a3b843cd0b40237a0b60bee5166d349f708df2e14d17', - votingAddress: 'ygt1Xk72M2rS4UsobWNLULdhu3y4yx2ppX', - isValid: false, - }, - { - proRegTxHash: '676c31b51634d92bdf986ef0b2c54462a4eb39885a4478e1dcc8722b7f705f21', - confirmedHash: '00000eefe1cedc451725cee0c13a9f00d00f161d7b763381540ca81794623c45', - service: '35.88.159.173:20001', - pubKeyOperator: '81655738125f19e6980bcb0131b14a057967430e216e7692f4368594503a93501f49c7110c410bb6c2662db519316168', - votingAddress: 'yT8pGvmdXHyqfUHkpPSdG2wXjHUqZeP9MV', - isValid: true, - }, - { - proRegTxHash: '8f9be44fb29faa32953aedb4c8387b1b516086eefaf317d9c784c484c9f05f21', - confirmedHash: '000007f9e1fac2a178c42c21381b2710a6db010e751f66f467cc57f670bfd9ac', - service: '54.149.124.44:20001', - pubKeyOperator: '11654b0c476944ba013048064d97bfd43b8b1c0e4bdca0df3266bc5200d3ecb9ac1d1b57f0eebbc87c2b52c7dc15dc40', - votingAddress: 'yND9nRg47m6oKuoMHG7m9YthQ63j8nbXyq', - isValid: true, - }, - { - proRegTxHash: 'a989f0987fee64422c506eea25e17e835d6b6cd3a0bcca4145a6b6a92b8fa9a4', - confirmedHash: '000015dd56ef887e9933a762036fb1f189274b1fcaec291a130df19a93c106ca', - service: '52.42.37.110:20001', - pubKeyOperator: '82cf7505be722ac14f1d8941083e6d4fe03ffde62f09761d5f83b42f32a9720f8fec9095a4a3fdcb73650817659b01f9', - votingAddress: 'ydxtPrsjP2DjgBTkcjFPSTCPHLixJE6hah', - isValid: true, - }, - { - proRegTxHash: '2c4a8e927837976a4fafba6934b9d867422edb5ee78cacd24caf73dcd1b912a4', - confirmedHash: '000014cf31e1698605620477e4e46ec7e4d606dabbaef290f1a75207ea009c9a', - service: '54.200.216.100:20001', - pubKeyOperator: '19745c5d4c43483e1984284b4b7bf9b868247ca66f7bad0a5e9bf0d251013d0cd784c32eb8ecf3c6e5c6746c2bd42000', - votingAddress: 'yNLAvV8QNwKhi4YSLzUGX3sT1v1p531j5M', - isValid: true, - }, - { - proRegTxHash: 'b3e34aea792739e76221569d17b749ee1dd1412bfec7dcd36375bfb19ea5cdeb', - confirmedHash: '0000155575c7d6761f13261c58a764186a3db72966d34681b52f62e03080a9f8', - service: '52.13.14.211:20001', - pubKeyOperator: '84812219574bf245639126fdf8d35f23fb3b30428ac8ecd0e2098cbb529d923447f38de7fdf22d191b3b4169ee4537fd', - votingAddress: 'yYXiDYLMQ8a4A89ETqMX3C4wsKvq9WitPH', - isValid: true, - }, - { - proRegTxHash: '4a959357fb77dd01fb53d14b0a765a8784ab65d7debc970e43976a92fcebf20b', - confirmedHash: '00002f8e243c50a74d919f4e2c559e8e55f7e74aa321aba6924e53a6b84fab01', - service: '54.191.200.9:20001', - pubKeyOperator: '16c9b81cae06a4de67f9c17469a251cb6163a704e798b6a297df4f3e1db53959da400a996ea5fb8af96acf13f7b4f9b6', - votingAddress: 'yb4s6aAe43AMdMw6oDtKZBQwRWB6Ut67PJ', - isValid: true, - }, - { - proRegTxHash: '3726e88b6d49f267784ab065788e0703b3ddd994b6b3b56dd7c8510ca2e5624d', - confirmedHash: '0000130e9fd2c852aff3ff0480339143c94a7183c495c0bad61181e0bbd90dfc', - service: '54.191.204.177:20001', - pubKeyOperator: '08738b60ae655d1383b18aff21aa3121d8cc2b627d4e34070202d30cac927e03e956c780381829adc7378aa5e48e4db1', - votingAddress: 'ydE5Uc5gjbYxLcJqaAR5iU78HRbaBoLtvo', - isValid: true, - }, - { - proRegTxHash: 'aac6640433ff777acdf68a062a38862de68386c40ed4bfc2847066f3f2cfbe6d', - confirmedHash: '00001fc6c61199b93b5e641e71064e82b0c5fcf8b9dbad2c989294299b321c0c', - service: '35.88.145.45:20001', - pubKeyOperator: '031d8cc6bb521aac7acef3947d9c798d9a5883e94eec2c33a2f1853afc87ec8e2aba4312a5769fbf51dae8f10238130f', - votingAddress: 'yfXCb8SG7oh9P1PvQRY7YrRQgm3o5rbqK4', - isValid: true, - }, - { - proRegTxHash: '7d49276009482414e81ad5fde49fd1666867391db2bc2ed77d8cadbb1ba028b3', - confirmedHash: '00002612152e315f67a823685b82cfbf162834e5dd5f3cf0a9ae64108fdc060c', - service: '54.184.206.178:20001', - pubKeyOperator: '87c39232f29bcb7933b460e47f1d3af4248a933f2ab93c227c146d0cca6bac3d0c8aa144b433c8a13a0d74b8f89251f5', - votingAddress: 'yMqKaoCvXRA2D2qWmJKbLp2tajmSTKWSYU', - isValid: true, - }, - { - proRegTxHash: '34e7c46d3cec0bc17d1b9c71179bc8621417d15e932d649277340bae77310eb3', - confirmedHash: '00002b1758c08c6ec9910a6b7847ee876774b42f0bf3cef892b604f2df64f70e', - service: '54.213.96.23:20001', - pubKeyOperator: '915b170f1fd26118445ccd47f82102e0859bcbb3a896eb50a20bb967c717521f4b472146a6e65b3950e52197688c3165', - votingAddress: 'yhgbpHvvynPRpsnfPCrgn9hUARidioXYeH', - isValid: true, - }, - { - proRegTxHash: 'd85000df24aa45f41d3cb8d5313444eea05d7886c72dfa64953da4eeeb31d313', - confirmedHash: '00002b1758c08c6ec9910a6b7847ee876774b42f0bf3cef892b604f2df64f70e', - service: '35.167.223.208:20001', - pubKeyOperator: '8d2be99d13751b0379f6834246ccaae18b472c66d30f963c3431a45e027106c4c716aa2d9a0ed6478b3405bcb57ab06f', - votingAddress: 'yPy4GgBgSt2XhFkKCx88sJYaABz6w94Ter', - isValid: true, - }, - { - proRegTxHash: '455b547bb4e923acf6333e3142d1b79a1b21ad493c63e285c35f277c88b3c0f4', - confirmedHash: '000016ec9d001a782d88758f46a38847d7f5127f81bf4d1d52f456e691885c4b', - service: '52.43.140.86:20001', - pubKeyOperator: '0209d35706fbc77a51d31d05f4338dff78c505486297e1bbf8bc4a76c8b63fcbecefb6bbb64afcfa7eb1ac74bb36bcb0', - votingAddress: 'ydgQUrgdPfWxcDQM3Gvy4n6SJ4Mpfaqi2p', - isValid: true, - }, - { - proRegTxHash: '28d86952a1cb11b93b44179b7e461f9e495f593625061c634432277423e327d4', - confirmedHash: '00000eefe1cedc451725cee0c13a9f00d00f161d7b763381540ca81794623c45', - service: '35.89.73.170:20001', - pubKeyOperator: '0001f5c96bb385a9c7cb70e3108aaf9878b78aa23938afdcfef2810a003df68238bb11985b77011d0a7f88b760889d9b', - votingAddress: 'ydRipsg3Y8gQ3BH51Wa6SBYH4UbWq2EufJ', - isValid: true, - }, - { - proRegTxHash: 'cd4408c93a70c9867a98d58de2ba59223d5c3595d671ba278768e159cfd79e34', - confirmedHash: '000017dd0692d81505aa11400ea923ff78935d9e6d099ed90d98326c1c1c8a59', - service: '35.160.69.130:20001', - pubKeyOperator: '88a1f4dc25de331451aa9ff6302df52c70ac9ab3305c72b4ed7644381cad08f3fb1b13ece303be8861cb51ffe0912d67', - votingAddress: 'yZNXi2sdbKw3q3NS6BJ7BDPqHohT7WwFq6', - isValid: true, - }, - { - proRegTxHash: '7dbf5fe4054208e4c291bf11efa50b9ee7bffdfea6eb0c173014b0d1e88b6234', - confirmedHash: '00000c17c2b7f648f8996056991c5050fb0f3044c0a74ce63e808949748e7060', - service: '34.209.149.21:20001', - pubKeyOperator: '0cc722ac6a142aab9688b726a63ac50781452eb04dde0866e17d737458c61e82f89978cd22b46a1ce729d1906a80cdf2', - votingAddress: 'ycs7tRs7GGNJLcqXvPgh8HcdGPBYptsTsR', - isValid: true, - }, - ], - deletedQuorums: [], - newQuorums: [ - { - version: 1, - llmqType: 101, - quorumHash: '00000235acaad85cb429d3d3738380fdbad54a62c778243329ac0e85e9fe6246', - quorumIndex: 0, - signersCount: 11, - signers: 'df0f', - validMembersCount: 12, - validMembers: 'ff0f', - quorumPublicKey: '171454d87dbed06c1d21d015360520bf597aa0680aad9634ca26531fe7d562db1359287ec15f6aef7f95d958d1b6053f', - quorumVvecHash: 'cf1cbb60e77248fb069849bd4dae3e008c1be6bb3ef8f443e740f2bcd46e2740', - quorumSig: '0025d7a0ce8af1e9aa973b5377aa126ec64575cac9e8a76523dc8392d54a5a86ee2a2c77e76e1a3a58da7481171199b5155e700869948472dbec15c83d21386f8e975231e80edf675e47c7dbdddfb500c30e2f464156396cb1736ae6a97f67fc', - membersSig: '06cf0c148ada4f3edf7e4f6fd7c85f9583917c69ebe2623604a62a4623017d0b407af2b862c1863bcd07ae983af2876316fdf8ca089fec414db735627ca8299433d5cfcbcb381745231190009e47e2542f2038f251ad530c8f3eb7ac1d768cd8', - }, - { - version: 1, - llmqType: 101, - quorumHash: '0000023338c0b7e3cad7ba8dc215e66d72e1cab576b49b60301d55c87dbda079', - quorumIndex: 0, - signersCount: 12, - signers: 'ff0f', - validMembersCount: 12, - validMembers: 'ff0f', - quorumPublicKey: '902ce689beaa8a37373527458e895e472d428a58cd39283a2cfaeaf5c9ca15edf020f4a73a47cbb8cc46036a25002450', - quorumVvecHash: '7387045318cc302b829f297c212e5d9a01a0c7c5845679c39ca9cb84a033d5f3', - quorumSig: '817553150ee276bc6db4157b0621aec244fd60074106a47b4ea2e492e90425b8dfc52f89e6637e9697c33e0bd39734c70f9957efd530d08c2af50c3114a88b838c7ad28362f2fad0bf0e435df3d327dddf8d0d1f061fa2f0a007acf029677681', - membersSig: '8e234578fcaaa5209b0193035af85e268eda497af9d618e5044329c8b1627f315d1facc712656df2bd5793ccdc4dc422031394593be92822f2f739f8940d4f641790b18542c89fa31daaf83ae5864565f44858619cf47800ddbf46696dc36e3f', - }, - { - version: 1, - llmqType: 101, - quorumHash: '0000013017cf3789a746f48a530a6aca0ae3ed5c61e8d2eccaaa6241d880149f', - quorumIndex: 0, - signersCount: 12, - signers: 'ff0f', - validMembersCount: 12, - validMembers: 'ff0f', - quorumPublicKey: '8e226205ec978e9cea558f660a1d7c94bcddf1a5dfe4d7e6988c52c4f90f36fd2f678bc64975577b0605a4656e6c9aed', - quorumVvecHash: '6da8bbe23839f8b68a60a854fc2ab8ca6137a60dc45292f796daefc6880f89f1', - quorumSig: '8987b814ad1554eeca876e7b27be9480455abf866f46c35fec7291f43d3ad87189c8064ed54ec4849c61031665570a8d17de1cda96db181750f151cee00b37ebc1d7b5c14a7c5779716aedbeff6647989907a6a5ef9bf745153978f819779611', - membersSig: '9284aa9f351fd2355eae288d340112d5e75362d5bf185c90e292f6a24b87c1ed0a75e2e43176bd01cb675bea029f96c917be99ba65da7d278f35084d7efd25519dbdd6d162463a15955450ec3337031ceeaf5e494243a3f27f75d96879e1c688', - }, - { - version: 1, - llmqType: 101, - quorumHash: '000002689db9739f18ef05392ee3480af7997a919916e26354634d46799373eb', - quorumIndex: 0, - signersCount: 12, - signers: 'ff0f', - validMembersCount: 12, - validMembers: 'ff0f', - quorumPublicKey: '0592f435b88b86244bfac0c29b43470ab21dc32bf28e802a4cc5b1f037097a70159010720e1c7365e482de8706cf0bb7', - quorumVvecHash: '543e6dacebfae025c7020a1620ab88a8da971467271e951a9d7beb7e5a42725d', - quorumSig: '0f725fdc9db1fb621d1ee3287e0369f8214807041253fa4e4687c51edcaf6f6ec650dbaf4eb71efe36ac4c0eec02831d0bcfcb0d4e9a95e62a49405f8b18db61a8a888cf8ff324bcd8513807caab69dc64d639e7f99718352eb7adc6b0741e5a', - membersSig: '04815452dbb926e98fb696ec5d180ebb8b4e15e6db7518397596a730addc436d865811555faf3c12bf2f3fa110434b7712334f595ecb6f9cdd69b9c9a04a5b6191c1060e630e6f316b1edfa4f70243152d95cce8ffd83620e9c967cd9484579f', - }, - ], - merkleRootMNList: '17b5e1d7371d8339e65dd90391e83b30b62ae9feafb4eee83f73599c5599255a', - merkleRootQuorums: '7ec72eb4a6b50d75afd4968d03f3417427124c2de9c63c0cddaa16275e5e1cbf', -}; - -describe('SimplifiedMNList', function () { - describe('applyDiff', function () { - it('should apply diff', function () { - const network = 'testnet'; - - const diff = new SimplifiedMNListDiff(rawDiff, network) - - new SimplifiedMNList(diff); - }); - }); -}); diff --git a/test/deterministicmnlist/SimplifiedMNList.js b/test/deterministicmnlist/SimplifiedMNList.js index 92d3f6462..b0e5fbecf 100644 --- a/test/deterministicmnlist/SimplifiedMNList.js +++ b/test/deterministicmnlist/SimplifiedMNList.js @@ -135,6 +135,174 @@ describe('SimplifiedMNList', function () { ); }); }); + + describe('#calculateMerkleRootQuorums', () => { + it('should calculate correct merkle root', () => { + const a = new QuorumEntry( + { + "version":1, + "llmqType":100, + "quorumHash":"753764c9fb6843b1533fad9f174415341f05d00567d58eb470d17264d9baa545", + "quorumIndex":0, + "signersCount":3, + "signers":"07", + "validMembersCount":3, + "validMembers":"07", + "quorumPublicKey":"10fda18d54b6951d95bb5ed0a3a8e394eb68fab071222e73578b98efbfeb4de175bf169144a8b018314e7b211bd3fb15", + "quorumVvecHash":"887542af974137fc0b41ce69750cbbda98b47d31b33092171395dec4abdfc984", + "quorumSig":"858820e9386a51f819c19557f0f0bd057425d53b260580262d475778f05427a9546c8896af806f7aaeafaa765290dc610ad3aa440df3075209f8a31229f9f762ddf6df2d0cd8d5c8775942f5e870cb6a839df2f13829307d4d9525cc61f406b9", + "membersSig":"07a245a7d3fbcea80491c085e2282b5f0962ee753cd18057158236728412a61b4c502465de6de9cdfc180813d4ddcfe019fc1585b9c3163f26869e7e9f370170d205425e0532dcb741e7b7b0ee9e22dd372cd4bd00e2da22ed0700ab6aa2c05e" + }); + + expect(a.calculateHash().toString('hex')) + .to.equals('23350208e4aba648d02e1fcb62e6c581b81f347371214f74ec774d21aeae27e9'); + + const b = new QuorumEntry({ + "version":1, + "llmqType":102, + "quorumHash":"753764c9fb6843b1533fad9f174415341f05d00567d58eb470d17264d9baa545", + "quorumIndex":0, + "signersCount":3, + "signers":"07", + "validMembersCount":3, + "validMembers":"07", + "quorumPublicKey":"84cf006c77d375083402f0e0c18f9e5ca43885e8c5878fbdf7e43fdb8cb16793342791d427b6a176fb53d63056ec464a", + "quorumVvecHash":"4a8a23f24ffd59d555d598406d94481f7483da1dcb617f7527141e51fff6ad08", + "quorumSig":"9997c5f302cdf437d72ba1f1398f7c1b4ca2746b41f21235ff78652de9d4951b8000ec8495efa965e79710a7a793e6a0159c3be54415c23292860adb7aac2116aa1709d1917df22f38be2d5651c1150bc1edb66496211286eef63ab3d4ebef0e", + "membersSig":"153ff3e9e33d5d95618636c5c1bcc49179a54bd272efa20b4ca7ff9c2422e0f2a623d7c0b84bdaf35476dd7d15be2b2a0d649f9821ca530f4a22cd1e4a4fdadc5c9b40ba9bd83c5732fd5b3fceb28cb7e7961769c16b538526f9450efa213331" + }); + + expect(b.calculateHash().toString('hex')). + to.equals('542a71b1252d42ac424757fde6674cbeeda3ff713d82b6f6196cec96a6f1a676'); + + const c = new QuorumEntry({ + "version":2, + "llmqType":103, + "quorumHash":"753764c9fb6843b1533fad9f174415341f05d00567d58eb470d17264d9baa545", + "quorumIndex":0, + "signersCount":4, + "signers":"0f", + "validMembersCount":4, + "validMembers":"0f", + "quorumPublicKey":"83e7a1e7a1392d45909e53f12d90324c2d561f5c36d4d71fdc36ace7aab309c26a46e7c5cca571d76ec3ba84cebe80b4", + "quorumVvecHash":"af5b393c6d0307c999ba07efed33f3c439cc9a942d7c00220bfa9428d496d0ca", + "quorumSig":"0e8f8da8d4d013a5a05d8f4db6fc1d713c64b3ede35ee9a9bfaecd00198453ebef44cebc4600eef354c7dbd56e4afa541875560efa9dee5fae3a61c0f20dc5a8501e3baf4b1d3b2c56e635fe5f1d15a770e54f4bea9c548be40dc9767a8efe4a", + "membersSig":"951d2c68f5772ec1f3be657d2388dc2755fd31c6b8e6cdb50e35f6b918dab16e8c521ba08408c98eb48f279bc5f303fe17ddf479a28681e9f6ba97e4ee5789d4d5fd5c1d1d39c081d1e6cc446720f920f21afc952f9ef478f2d90bd61b6fe118" + }); + + expect(c.calculateHash().toString('hex')). + to.equals('761e0a139dd1b516d00e880c0779947aa3e81e970e58bf21c8cf582b3d60cdab'); + + const d = new QuorumEntry({ + "version":2, + "llmqType":103, + "quorumHash":"3cf85c30b5fd9c8175460aebc1db57a3b575421c79000ab8d5d8b1e9d19dd8de", + "quorumIndex":1, + "signersCount":4, + "signers":"0f", + "validMembersCount":4, + "validMembers":"0f", + "quorumPublicKey":"89f2a917eb187bf5abd8e34941ca4cfde325c511404f58885b46c6fe547337859ca24ac26f8fa71a2a572b23990c21bd", + "quorumVvecHash":"eebbb2e715d770125441fbe44d43aab51da703016023fc4e6242122d20d12426", + "quorumSig":"91533cc7cedc920e570e097d886a5a20eae94fd53e4609b8c851ce28fd20404150d04f821382b6ccac2e950a1da3162f1815c8d1c7d36fc6343ccd8708aa9f2a4f65e4e2b85b0ec959447dad6b3ec1ba3da691b4e1f07b93d6aa27f065bac8b5", + "membersSig":"09798d17fa28c6c7396a5f1b94ac39e087921f71e04d8f5c4be08bcc818352993bc803b0a3a82b7d93c580609a2881f90369f589bda164c1dbe25ded81e6940b3330a27fe0babea5e563f0ac2a5f4fc4772df695a4011b87b320db59e9686b8e" + }); + + expect(d.calculateHash().toString('hex')). + to.equals('cd1da276eef9d76ed926932b89cf584c0e807fab50ffb31080b6c214ec2c6036'); + + const e = new QuorumEntry({ + "version":1, + "llmqType":100, + "quorumHash":"2abceb6f8b3848789362da70b46ab9ea96e56202dedd673533623cc7c43c79db", + "quorumIndex":0, + "signersCount":3, + "signers":"07", + "validMembersCount":3, + "validMembers":"07", + "quorumPublicKey":"88d39a648d0f45300c9cff22bf990202710620b04a621ee4bdee3d6dd7c9faedde9d37d0f5d75e1625a2c72aa76b691f", + "quorumVvecHash":"4b744dd205f212e5b9df8a8c98345501e4bc0f6ed3c6c1722044b51b805eeb5f", + "quorumSig":"0274638292a2274a4c83c809f09ce107de20e66afd4aed3d4f285fe0834a4bf6302dd5f07ff92707d2b48a9ad2ccb91701f155cdd13b362eceeaf600b2a0de634b9b2c93feae7b10db72ea188ca67de1541de30b0e363c5ed05e8e67049ac822", + "membersSig":"1385f8f688fed1436392add78d3efc630f541c1b70f4b069c2136161347774465d8db8f47f1be73e7b660b00f85ae1410fa63d691923d5a240fc730f567f84707449ab6edd1c5c33bc6f0d807aacf6eb27ef3d3bd42609790db1cc9305c7baa7" + }); + + expect(e.calculateHash().toString('hex')). + to.equals('c1150593cebc12c396b1cb130926a5e42a89ba0e64405fb9e28132ce02e43e82'); + + const f = new QuorumEntry({ + "version":1, + "llmqType":102, + "quorumHash":"2abceb6f8b3848789362da70b46ab9ea96e56202dedd673533623cc7c43c79db", + "quorumIndex":0, + "signersCount":3, + "signers":"07", + "validMembersCount":3, + "validMembers":"07", + "quorumPublicKey":"0cace77871b3f6e7bdaf909dfbd350a8910fde13350785fd110a050af303fa3f3ab6ef111c73cd490ade534bc7590524", + "quorumVvecHash":"b67614987cffa0201990e095b2fc6c6351cb7535f3cc5906c7459c94feab1af2", + "quorumSig":"91ea8d9125e89fbf49afb412fc1fb5b7c1c844f4c7157820f9817da3ce5689dfba67a67aa4830b22f91e0489cf40dc58172dde5788507889e71aa7dd3014e9d858d9b0b226a96fd756ff8e8c675626c2245687114962ee2a102ce97a34e9f715", + "membersSig":"8ca216d27dc62edee4a909603d426e2779bd758347e6afaee8f1b45f479013dc64c38118a5a771fab05813962a349147189c0c2880b6a38785ebe1d7004ccd4f6b5f74e7e39836515019a4377cd28016ec47feab6fcf366172553479c0e21108" + }); + + expect(f.calculateHash().toString('hex')). + to.equals('93fe389f39ccc23490a3a60e3e35382991818689ad0f5cb0159f4b0c600e7bd5'); + + const g = new QuorumEntry({ + "version":2, + "llmqType":103, + "quorumHash":"2abceb6f8b3848789362da70b46ab9ea96e56202dedd673533623cc7c43c79db", + "quorumIndex":0, + "signersCount":4, + "signers":"0f", + "validMembersCount":4, + "validMembers":"0f", + "quorumPublicKey":"82c91daa836e3bba53796df4fe9e16e717d4d7d571ef96a38307a19cf63f0222031b116ccbb0c4c367bf971e7855a138", + "quorumVvecHash":"b1661364baa68d9adbe2248b026ca3a95e5be738960367d38dbfb6ec124d6d48", + "quorumSig":"95b4ae8182accbc88d280231c615d663ff78b8cb0771b7eea12126f3aacfe597b6ba2bf6579f89dd4ea1136c628c0a2a12a973aac64360586e2500f3a73eb630c5613fbd0cead2f47e0692d5a11d57b4e181b0c006c5f2f1b0c7d0aff33ecf7b", + "membersSig":"8c93ab82e3dc94a1204b651c5ecee5640d03c117e7fdb516a819804e2ae996ad5c6dd413be27f000ee7f719157e65c0e18daa81919859711b18f524bc9993cc8e4f124a2fadfe1a8c1f57b5586f90a90853e5e07b4f5002ac4a9e5c438d8f7d1" + }); + + expect(g.calculateHash().toString('hex')). + to.equals('4d9fb3b6978f4bb786f93d179124404b07786012464db955d0c700cb6c2428d6'); + + const h = new QuorumEntry({ + "version":2, + "llmqType":103, + "quorumHash":"30e73f8500d030a2d9fbfd54f2b63198c85f38f183268c0fce5a5772e13fabbd", + "quorumIndex":1, + "signersCount":4, + "signers":"0f", + "validMembersCount":4, + "validMembers":"0f", + "quorumPublicKey":"0ef7c6b5ace22d3ced4947e8713a81c0b2ae3cb0c02d1388cc076fe07a13d5c5b02605653375f8707818653e90edaac7", + "quorumVvecHash":"b063f660d1ea711fe1013c620afdd052ec02d7f0ee776618683063d0a800ab7e", + "quorumSig":"10f15b80ee90d2b0e8d8d1e6b2c421a66f8e0a9f6fe20524313ff0dd53694d1077e04831a504fa49129cfa57f43b94970905ae73e5562ff5a07195cf9e2792bd28f423685a05ed245ecf25bef12e032168cea191986319ccfbf7da33d4e95b6b", + "membersSig":"8b61b88a9cccd789398688a138a307a59138aad1e7d1addafd739e0f039d3468e0d52ae1a63cb0496bbfa522c9aebd990fd4d69dbe8755825a3161b2c14854fedeb0b69d1729df5f40c3bad8994a9c19c3c6deea0b3b06e37c19d37d628e7617" + }); + + expect(h.calculateHash().toString('hex')). + to.equals('f8b6236919cb712f700351643e4935194aee65a32e1996b0e607552e509c2e72'); + + const list = new SimplifiedMNList(); + + list.quorumList = list.sortQuorums([a, b]); + + expect(list.calculateMerkleRootQuorums()).to.equals('9cf6e2f5d7f4fc3c1368ae07e41fb3fffea5138049ffe45d6427126e7408f8fa'); + + list.quorumList = list.sortQuorums([a, b, c, d]); + + expect(list.calculateMerkleRootQuorums()).to.equals('b4f1f416e8a4735e97eb35eb37d58941edf58be3fa8bf4993cc63076c046e04e'); + + list.quorumList = list.sortQuorums([a, b, c, d, e, f]); + + expect(list.calculateMerkleRootQuorums()).to.equals('03e3f9fe915fa099111766ee5a511978f6aefd6c15d896b27ae18ec6178cc257'); + + list.quorumList = list.sortQuorums([a, b, g, h, e, f]); + + expect(list.calculateMerkleRootQuorums()).to.equals('ed2fe2bcade6634e740892dcf1c11b2bd19f2250bbd905af4911c6e2435292aa'); + }) + }); + describe('getValidMasternodesList', function () { it('Should return a valid masternodes list', function () { var mnList = new SimplifiedMNList(SMNListFixture.getFirstDiff());