-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf/integration tests: Preparing for precalculated wallet addresses …
…lib feature (#189) * feat: new benchmark utils * feat: new wallet address precalculation tool * test: integrates precalculated wallets into tests * fix: wallet generation script discarding relevant data * style: eslint fixes * test: skipping all multisig tests * test: basic wallet precalculation helper tests passing * test: persistent storage interaction for wallet precalculation * test: increased test coverage for the precalculation helper * docs: adds jsdocs to precalculation helper methods and interactions * test: adds coverage to new address pre-calculation parameter * test: removes developer scripts from application code coverage * refactor: moved test constants to new file * ci: force exit on tests * test: skip multisig start test * ci: removes force exit on mocked tests * docs: adjustments to jsdocs * test: generate all multisig wallets for a group of seeds * ci: fix open connection handles at the end of the tests * test: stopping the wallet before each '/start' test * ci: added async to beforeEach to prevent issues * docs: adds missing jsdocs and improves existing ones * fix: multisig generation flag and precalculated addresses * test: removing skip from multisig tests * refactor: moves ./src/utils folder to ./scripts * chore: updated wallet-lib version to 0.36.0 * docs: adds file headers to new helpers and utils * refactor: reusing existing lib constants * docs: clarifies location of addresses storage * fix: updating wallet benchmark failure flag on error * refactor: removes obsolete parameter from startMultipleWalletsForTest * docs: clarifies and updates WalletData typedef * fix: transaction summary amount * docs: clarifies wallets file update on test setup * docs: instructions on how to use the generate_wallets script * feat: common wallet addresses generated using lib utils Before, the full wallet constructor was being used. * refactor: generating multisig wallets directly from lib methods Before they were generated using the complete wallet instance. * style: improved generator function name * refactor: moved wallet-precalculation.helper.js to /scripts/helpers * docs: fixes ambiguity on the docs and constant variables * refactor: moved 24-word seed generation to common wallet code branch * chore: removing used wallets json file at the end of the tests
- Loading branch information
Showing
32 changed files
with
1,720 additions
and
378 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
284 changes: 284 additions & 0 deletions
284
__tests__/integration/configuration/precalculated-multisig-wallets.json
Large diffs are not rendered by default.
Oops, something went wrong.
102 changes: 102 additions & 0 deletions
102
__tests__/integration/configuration/precalculated-wallets.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import { constants as libConstants, transaction as transactionUtils } from '@hathor/wallet-lib'; | ||
|
||
/** | ||
* @type {Record<string,WalletData>} | ||
*/ | ||
export const WALLET_CONSTANTS = { | ||
genesis: { | ||
walletId: 'genesiswallet', | ||
words: 'avocado spot town typical traffic vault danger century property shallow divorce festival spend attack anchor afford rotate green audit adjust fade wagon depart level', | ||
addresses: [ | ||
'WPhehTyNHTPz954CskfuSgLEfuKXbXeK3f', | ||
'WY1URKUnqCTyiixW1Dw29vmeG99hNN4EW6', // Genesis funds, index 1 | ||
'WRTFYzhTHkfYwub8EWVtAcUgbdUpsYMBpb', | ||
'WhpJeUtBLrDHbKDoMC9ffMxwHqvsrNzTFV', | ||
'WeBBm1LfKBH3V5rEL5DAHtjjDiAws3Z83m', | ||
'WWTNERwV3dcvWjCbR4rizMuEqPbFjZsd3C', | ||
'WR4EQB8wZUzsVnqhodBBbtYsvKxrr9puG7', | ||
'WjJZoqV3AbRfgBWNfjAyVYTydFuWNPgspW', | ||
'Wh2FHvahkwvt29saUz7jnhuDh3WDHuc2ZY', | ||
'Wg5bXXQpRE5DWwsGDNfHsKyisJPVotxhhS', | ||
'WiodAJyH67sSTGgpRPXWsVGEfGESN7ykEt', | ||
'WNpFPr1EDwBgtTqYUNTbKTRpbGj6vdNgdL', | ||
'WVPeyNm4pWjJJixjj1DsRc4ceYd75xCyxq', | ||
'WcZotwyy1FnFYuA8D2LqrUBSNEFcPr3T7a', | ||
'Wki6BdLTCzS4ZoQSY1QgfgzQdgT9R3txEb', | ||
'Wgk7UPN4zZZdMbsCNMSosRwsvHtMoWf8S6', | ||
'Wmqn3sanBexFaNk3nDtdb4SnHxB5MRzr7m', | ||
'Wbh9FrUF85FWUh7xgpqf9gjH7D2f3Py4kc', | ||
'WWGKeK7yJcKqvxMj2C8TFFJLooqq8Kc65z', | ||
'WRenJ9f6yqrYRzBUwqbBFAxAY7JzwryKut', | ||
'WQozCB8X2FFM9QtEMoPjo6xERVTkiBw8Mj', | ||
'Wds8d4vy691GwVDdzKrw1LpnvBR283VTci', | ||
] | ||
}, | ||
miner: { | ||
walletId: 'miner-wallet', | ||
words: 'scare more mobile text erupt flush paper snack despair goddess route solar keep search result author bounce pulp shine next butter unknown frozen trap', | ||
addresses: [ | ||
'WTjhJXzQJETVx7BVXdyZmvk396DRRsubdw', // Miner rewards address | ||
'Wdf7xQtKDNefhd6KTS68Vna1u4wUAyHjLQ', | ||
'WaQf5igKpbdNyxTBzc3Nv8a8n4DRkcbpmX', | ||
'WYzcaxpK4x8XjZKkvcpb5CXKuEsfAsD3vD', | ||
'WjfMPKn7prjXUdzp7dFAxuDGreSTArnScE', | ||
'WVE1uwNor9Haitx2qGu9SB4uv4wVwGAWDP', | ||
'WbDaM4VGcWMBXPihJrViiYDphM7WoGDMWQ', | ||
'WgPiV4KvwaeKeRxj434ZjkvakX23hBhLyd', | ||
'We1t89h3YJuj9eU1SGfNwamk9FRBv3GhgD', | ||
'WeDLxQhv4vs4K8HVy4FUPBWSsN49rNYGKd', | ||
'WetZFhUkFqfv73k7AzcQm95vnRHCRzH7vQ', | ||
'WNgP5CEqhW4yMLjARi7JVMh9iapnUcTQtG', | ||
'WUr1RDAZVLY7w6M5M416uXLxpFekcXz1WH', | ||
'WexLCpMTBdgAbhH8Br2sCn6SPu44CZWSpK', | ||
'WWUdwEecrcFTdaFz1ZkeL1ZzyRg4YsvnY7', | ||
'WmpwqZg1KCQvBMxaE6BLgFrSv2AZS1FCw5', | ||
'WfiWuwxqcJMPSfjpDhqtRfW3sDg78hg34y', | ||
'Wh781JkXsumkTZKMKZmV4BjV8Nnjevkxkk', | ||
'Wb6792ceTDSJdySvQm7tikrNva4FRuVsUX', | ||
'WYZigDNfJ6x5T7VfVrgd1CtkKGfoBRRbyr', | ||
'WWGWrrUqpbP4ekx4zoNtBsrhCSEspxpDyA', | ||
'WgWfrJqAgS3RwzXMMz8fywidQAUx6a5smc' | ||
] | ||
}, | ||
}; | ||
|
||
export const TOKEN_DATA = { | ||
HTR: 0, | ||
TOKEN: 1, | ||
|
||
/** | ||
* Checks if this token_data indicates this is an authority output, that is, if its 8th bit from | ||
* the right is 1. | ||
* @see https://github.com/HathorNetwork/rfcs/blob/master/text/0004-tokens.md#token_data-field | ||
* @param {number} tokenData "token_data" property from an output | ||
* @returns {boolean} True if this is an authority output | ||
*/ | ||
isAuthorityToken: tokenData => transactionUtils.isTokenDataAuthority(tokenData) | ||
|
||
}; | ||
|
||
export const AUTHORITY_VALUE = { | ||
MINT: libConstants.TOKEN_MINT_MASK, | ||
MELT: libConstants.TOKEN_MELT_MASK | ||
}; | ||
|
||
export const HATHOR_TOKEN_ID = libConstants.HATHOR_TOKEN_CONFIG.uid; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.