From 4401156b79068e4aa7129fcffbd18eb1175e9329 Mon Sep 17 00:00:00 2001 From: Karoly Albert Szabo Date: Wed, 12 Dec 2018 16:58:23 +0100 Subject: [PATCH 01/99] Added undelegation transactions to TabMyDelegation --- CHANGELOG.md | 1 + .../components/staking/TabMyDelegations.vue | 57 +++++++++++++++++-- .../staking/TabMyDelegations.spec.js | 17 ++++++ .../TabMyDelegations.spec.js.snap | 38 +++++++++++++ 4 files changed, 108 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed884b77d7..a07435bf42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - [\#1690](https://github.com/cosmos/voyager/issues/1690) Feedbacks when Amount is not between valid thresholds @sabau - [\#1673](https://github.com/cosmos/voyager/issues/1673) Documentation and single command to run one or all tests with fallback for end to end test @sabau - [\#1683](https://github.com/cosmos/voyager/issues/1683) Governance: block voting twice for the same option @sabau +- [\#1387](https://github.com/cosmos/voyager/issues/1387) Staking: Added list of undelegation transactions @sabau ### Changed diff --git a/app/src/renderer/components/staking/TabMyDelegations.vue b/app/src/renderer/components/staking/TabMyDelegations.vue index 40f8f0f9c9..2bbacd7a3f 100644 --- a/app/src/renderer/components/staking/TabMyDelegations.vue +++ b/app/src/renderer/components/staking/TabMyDelegations.vue @@ -31,23 +31,51 @@ +
+

+ Unbounding transactions + + info_outline + +

+ +
@@ -77,6 +121,9 @@ export default { font-weight: 500; margin: 1rem 1rem 0 2rem; } +.tab-header.transactions { + margin: 2rem; +} .info-button { color: var(--link); diff --git a/test/unit/specs/components/staking/TabMyDelegations.spec.js b/test/unit/specs/components/staking/TabMyDelegations.spec.js index a0bcec3bb9..1b4b03aded 100644 --- a/test/unit/specs/components/staking/TabMyDelegations.spec.js +++ b/test/unit/specs/components/staking/TabMyDelegations.spec.js @@ -132,6 +132,23 @@ describe(`Component: TabMyDelegations`, () => { ).toEqual([delegates[1], delegates[2]]) }) + it(`unbondingTransactions`, async () => { + const address = delegates[0].operator_address + const transactions = await lcdClientMock.getDelegatorTxs( + lcdClientMock.addresses[0] + ) + expect( + TabMyDelegations.computed.unbondingTransactions({ + delegation: { + unbondingDelegations: { + [address]: 1 + } + }, + transactions: { staking: transactions } + }) + ).toHaveLength(1) + }) + it(`yourValidators`, () => { expect( TabMyDelegations.computed.yourValidators({ diff --git a/test/unit/specs/components/staking/__snapshots__/TabMyDelegations.spec.js.snap b/test/unit/specs/components/staking/__snapshots__/TabMyDelegations.spec.js.snap index df007a3f33..849e7a0aa1 100644 --- a/test/unit/specs/components/staking/__snapshots__/TabMyDelegations.spec.js.snap +++ b/test/unit/specs/components/staking/__snapshots__/TabMyDelegations.spec.js.snap @@ -51,6 +51,8 @@ exports[`Component: TabMyDelegations should show a message if not staked yet to + + `; @@ -546,6 +548,24 @@ exports[`Component: TabMyDelegations should show committed validators 1`] = ` + +
+

+ + Unbounding transactions + + + + info_outline + + +

+ +
`; @@ -890,5 +910,23 @@ exports[`Component: TabMyDelegations should show unbonding validators 1`] = ` + +
+

+ + Unbounding transactions + + + + info_outline + + +

+ +
`; From f7a4dd5b5e81be1ec842972c571d80c84f0288a5 Mon Sep 17 00:00:00 2001 From: Karoly Albert Szabo Date: Thu, 13 Dec 2018 12:15:49 +0100 Subject: [PATCH 02/99] simplified logic for modifiers, updated tests - setUnbondingDelegations now takes as input an array instead of doing that from outside Signed-off-by: Karoly Albert Szabo --- CHANGELOG.md | 1 + app/src/renderer/vuex/modules/delegation.js | 57 ++++++------------- .../__snapshots__/PageGovernance.spec.js.snap | 4 +- .../__snapshots__/PageStaking.spec.js.snap | 4 +- .../__snapshots__/PageWallet.spec.js.snap | 4 +- .../__snapshots__/delegation.spec.js.snap | 8 +-- test/unit/specs/store/delegation.spec.js | 32 ++++++----- test/unit/specs/store/store.spec.js | 12 ++-- 8 files changed, 54 insertions(+), 68 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a07435bf42..5b22bd7dc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -81,6 +81,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - [\#1638](https://github.com/cosmos/voyager/issues/1638) removed account password from the state and now user has to input it on every transaction @fedekunze - [\#1655](https://github.com/cosmos/voyager/issues/1655) Text and Textarea fields trimmed @sabau - [\#1686](https://github.com/cosmos/voyager/issues/1686) Changed proposals from array to object @sabau +- [\#1387](https://github.com/cosmos/voyager/issues/1387) Delegation: modifiers simplified, setUnbondingDelegations takes an array as input now as the name suggest and replace the current dictionary with a new one @sabau ### Fixed diff --git a/app/src/renderer/vuex/modules/delegation.js b/app/src/renderer/vuex/modules/delegation.js index 44beb52700..2e99c275d8 100644 --- a/app/src/renderer/vuex/modules/delegation.js +++ b/app/src/renderer/vuex/modules/delegation.js @@ -33,32 +33,26 @@ export default ({ node }) => { state.delegates = state.delegates.filter(c => c.id !== delegate) }, setCommittedDelegation(state, { candidateId, value }) { - let committedDelegates = Object.assign({}, state.committedDelegates) + state.committedDelegates[candidateId] = value if (value === 0) { - delete committedDelegates[candidateId] - } else { - committedDelegates[candidateId] = value + delete state.committedDelegates[candidateId] } - state.committedDelegates = committedDelegates }, - setUnbondingDelegations( - state, - { validator_addr, min_time, balance, creation_height } - ) { - let unbondingDelegations = Object.assign({}, state.unbondingDelegations) - if (balance.amount === 0) { - delete unbondingDelegations[validator_addr] - } else { - unbondingDelegations[validator_addr] = { - min_time, - balance, - creation_height - } - } + setUnbondingDelegations(state, unbondingDelegations) { state.unbondingDelegations = unbondingDelegations + // building a dict from the array and taking out the transactions with amount 0 + .reduce( + (dict, { validator_addr, ...delegation }) => ({ + ...dict, + // filtering out the transactions with amount 0 + ...(delegation.balance.amount > 0 && { + [validator_addr]: delegation + }) + }), + {} + ) } } - let actions = { reconnected({ state, dispatch }) { if (state.loading) { @@ -82,11 +76,11 @@ export default ({ node }) => { try { let delegations = await node.getDelegations(address) - let unbonding_delegations = await node.getUndelegations(address) + let unbondingDelegations = await node.getUndelegations(address) let redelegations = await node.getRedelegations(address) let delegator = { delegations, - unbonding_delegations, + unbondingDelegations, redelegations } state.error = null @@ -126,24 +120,7 @@ export default ({ node }) => { }) }) - if (delegator.unbonding_delegations) { - delegator.unbonding_delegations.forEach(ubd => { - commit(`setUnbondingDelegations`, ubd) - }) - } - // delete undelegations not present anymore - Object.keys(state.unbondingDelegations).forEach(validatorAddr => { - if ( - !delegator.unbonding_delegations || - !delegator.unbonding_delegations.find( - ({ validator_addr }) => validator_addr === validatorAddr - ) - ) - commit(`setUnbondingDelegations`, { - validator_addr: validatorAddr, - balance: { amount: 0 } - }) - }) + commit(`setUnbondingDelegations`, unbondingDelegations) } catch (error) { commit(`notifyError`, { title: `Error fetching delegations`, diff --git a/test/unit/specs/components/governance/__snapshots__/PageGovernance.spec.js.snap b/test/unit/specs/components/governance/__snapshots__/PageGovernance.spec.js.snap index 2220316dd8..ef93570342 100644 --- a/test/unit/specs/components/governance/__snapshots__/PageGovernance.spec.js.snap +++ b/test/unit/specs/components/governance/__snapshots__/PageGovernance.spec.js.snap @@ -153,7 +153,7 @@ exports[`PageGovernance has the expected html structure 1`] = ` Total Steak

- 1,351.0000… + 1,337.0000…

@@ -213,7 +213,7 @@ exports[`PageGovernance has the expected html structure 1`] = ` Total Steak

- 1,351.0000… + 1,337.0000…

diff --git a/test/unit/specs/components/staking/__snapshots__/PageStaking.spec.js.snap b/test/unit/specs/components/staking/__snapshots__/PageStaking.spec.js.snap index 6f92c944aa..c81241b8ab 100644 --- a/test/unit/specs/components/staking/__snapshots__/PageStaking.spec.js.snap +++ b/test/unit/specs/components/staking/__snapshots__/PageStaking.spec.js.snap @@ -18,7 +18,7 @@ exports[`PageStaking has the expected html structure 1`] = ` Total Steak

- 1,351.0000… + 1,337.0000…

@@ -79,7 +79,7 @@ exports[`PageStaking has the expected html structure 1`] = ` Total Steak

- 1,351.0000… + 1,337.0000…

diff --git a/test/unit/specs/components/wallet/__snapshots__/PageWallet.spec.js.snap b/test/unit/specs/components/wallet/__snapshots__/PageWallet.spec.js.snap index 93443e839b..957febc5ae 100644 --- a/test/unit/specs/components/wallet/__snapshots__/PageWallet.spec.js.snap +++ b/test/unit/specs/components/wallet/__snapshots__/PageWallet.spec.js.snap @@ -44,7 +44,7 @@ exports[`PageWallet has the expected html structure 1`] = `

- 1,014.0000… + 1,000.0000…

@@ -423,7 +423,7 @@ exports[`PageWallet should filter the balances 1`] = `

- 1,014.0000… + 1,000.0000…

diff --git a/test/unit/specs/store/__snapshots__/delegation.spec.js.snap b/test/unit/specs/store/__snapshots__/delegation.spec.js.snap index c65c64535d..e1a410e445 100644 --- a/test/unit/specs/store/__snapshots__/delegation.spec.js.snap +++ b/test/unit/specs/store/__snapshots__/delegation.spec.js.snap @@ -12,15 +12,15 @@ Object { "balance": Object { "amount": "356.0000000000", }, - "creation_height": undefined, - "min_time": undefined, + "delegator_addr": "cosmos15ky9du8a2wlstz6fpx3p4mqpjyrm5ctpesxxn9", + "shares": "356.0000000000", }, "cosmosvaladdr15ky9du8a2wlstz6fpx3p4mqpjyrm5ctqzh8yqw": Object { "balance": Object { "amount": "113.0000000000", }, - "creation_height": undefined, - "min_time": undefined, + "delegator_addr": "cosmos15ky9du8a2wlstz6fpx3p4mqpjyrm5ctpesxxn9", + "shares": "113.0000000000", }, } `; diff --git a/test/unit/specs/store/delegation.spec.js b/test/unit/specs/store/delegation.spec.js index 331349df39..d7b7024ff4 100644 --- a/test/unit/specs/store/delegation.spec.js +++ b/test/unit/specs/store/delegation.spec.js @@ -141,10 +141,12 @@ describe(`Module: Delegations`, () => { it(`deletes undelegations that are 0`, async () => { await store.dispatch(`getBondedDelegates`, store.state.delegates.delegates) - store.commit(`setUnbondingDelegations`, { - validator_addr: `cosmosvaladdr15ky9du8a2wlstz6fpx3p4mqpjyrm5ctqzh8yqw`, - balance: { amount: 0 } - }) + store.commit(`setUnbondingDelegations`, [ + { + validator_addr: `cosmosvaladdr15ky9du8a2wlstz6fpx3p4mqpjyrm5ctqzh8yqw`, + balance: { amount: 0 } + } + ]) expect( store.state.delegation.unbondingDelegations .cosmosvaladdr15ky9du8a2wlstz6fpx3p4mqpjyrm5ctqzh8yqw @@ -227,10 +229,12 @@ describe(`Module: Delegations`, () => { ] await store.dispatch(`submitDelegation`, { stakingTransactions }) - store.commit(`setUnbondingDelegations`, { - validator_addr: lcdClientMock.validators[0], - balance: { amount: `100` } - }) + store.commit(`setUnbondingDelegations`, [ + { + validator_addr: lcdClientMock.validators[0], + balance: { amount: `100` } + } + ]) expect( store.state.delegation.unbondingDelegations[lcdClientMock.validators[0]] ).toBeTruthy() @@ -241,12 +245,14 @@ describe(`Module: Delegations`, () => { candidateId: lcdClientMock.validators[1], value: 1 }) - store.commit(`setUnbondingDelegations`, { - validator_addr: lcdClientMock.validators[1], - balance: { - amount: 1 + store.commit(`setUnbondingDelegations`, [ + { + validator_addr: lcdClientMock.validators[1], + balance: { + amount: 1 + } } - }) + ]) expect( store.state.delegation.committedDelegates[lcdClientMock.validators[1]] ).toBeTruthy() diff --git a/test/unit/specs/store/store.spec.js b/test/unit/specs/store/store.spec.js index f8e18d5d64..ac4ba7e498 100644 --- a/test/unit/specs/store/store.spec.js +++ b/test/unit/specs/store/store.spec.js @@ -64,11 +64,13 @@ describe(`Store`, () => { candidateId: lcdClientMock.validators[0], value: 1 }) - store.commit(`setUnbondingDelegations`, { - validator_addr: lcdClientMock.validators[1], - balance: { amount: 1 }, - min_time: new Date().toUTCString() - }) + store.commit(`setUnbondingDelegations`, [ + { + validator_addr: lcdClientMock.validators[1], + balance: { amount: 1 }, + min_time: new Date().toUTCString() + } + ]) jest.runAllTimers() // updating is waiting if more updates coming in, this skips the waiting await store.dispatch(`signOut`) From 21c669d23287fe8415af3bd54c5caae7f753c8fe Mon Sep 17 00:00:00 2001 From: Karoly Albert Szabo Date: Thu, 13 Dec 2018 12:48:11 +0100 Subject: [PATCH 03/99] update e2e test and fix modifier behaviour value in case of null Signed-off-by: Karoly Albert Szabo --- app/src/renderer/vuex/modules/delegation.js | 24 +++++++++++---------- test/e2e/delegation.js | 8 ++++--- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/app/src/renderer/vuex/modules/delegation.js b/app/src/renderer/vuex/modules/delegation.js index 3b46a24d15..fd751d0271 100644 --- a/app/src/renderer/vuex/modules/delegation.js +++ b/app/src/renderer/vuex/modules/delegation.js @@ -40,17 +40,19 @@ export default ({ node }) => { }, setUnbondingDelegations(state, unbondingDelegations) { state.unbondingDelegations = unbondingDelegations - // building a dict from the array and taking out the transactions with amount 0 - .reduce( - (dict, { validator_addr, ...delegation }) => ({ - ...dict, - // filtering out the transactions with amount 0 - ...(delegation.balance.amount > 0 && { - [validator_addr]: delegation - }) - }), - {} - ) + ? unbondingDelegations + // building a dict from the array and taking out the transactions with amount 0 + .reduce( + (dict, { validator_addr, ...delegation }) => ({ + ...dict, + // filtering out the transactions with amount 0 + ...(delegation.balance.amount > 0 && { + [validator_addr]: delegation + }) + }), + {} + ) + : {} } } let actions = { diff --git a/test/e2e/delegation.js b/test/e2e/delegation.js index e3823b200c..e4d3d7a1f4 100644 --- a/test/e2e/delegation.js +++ b/test/e2e/delegation.js @@ -65,11 +65,13 @@ test(`delegation`, async function(t) { t.test(`Stake`, async t => { let totalAtoms = (await app.client .$(`.header-balance .total-atoms h2`) - .getText()).split(`.`)[0] // 130.000... + .getText()).split(`.`)[0] // 30.000... let unbondedAtoms = (await app.client .$(`.header-balance .unbonded-atoms h2`) .getText()).split(`.`)[0] // 30.000... + await t.equal(totalAtoms, `30`, `i have 30 Atoms`) + await t.equal(unbondedAtoms, `30`, `i have 30 unbbounded Atoms`) // Select the second validator. await app.client.click(`//*[. = 'local_2']`) @@ -101,11 +103,11 @@ test(`delegation`, async function(t) { // then the users has await waitForText( () => app.client.$(`.header-balance .total-atoms h2`), - `${totalAtoms}.0000…` + `${parseInt(totalAtoms) - 10}.0000…` ) await waitForText( () => app.client.$(`.header-balance .unbonded-atoms h2`), - `${unbondedAtoms - 10}.0000…` + `${parseInt(unbondedAtoms) - 10}.0000…` ) await closeNotifications(app) From c18670a8f3bd9ecaf02fab36a17184026eb8079d Mon Sep 17 00:00:00 2001 From: Karoly Albert Szabo Date: Thu, 13 Dec 2018 13:10:19 +0100 Subject: [PATCH 04/99] test timeDiff Signed-off-by: Karoly Albert Szabo --- .../specs/components/staking/TabMyDelegations.spec.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/unit/specs/components/staking/TabMyDelegations.spec.js b/test/unit/specs/components/staking/TabMyDelegations.spec.js index 1b4b03aded..b73c13ab0b 100644 --- a/test/unit/specs/components/staking/TabMyDelegations.spec.js +++ b/test/unit/specs/components/staking/TabMyDelegations.spec.js @@ -1,6 +1,7 @@ import setup from "../../../helpers/vuex-setup" import lcdClientMock from "renderer/connectors/lcdClientMock.js" import TabMyDelegations from "renderer/components/staking/TabMyDelegations" +import moment from "moment" const delegates = lcdClientMock.candidates @@ -149,6 +150,13 @@ describe(`Component: TabMyDelegations`, () => { ).toHaveLength(1) }) + it(`should return the time diff`, () => { + const now = new Date() + expect(TabMyDelegations.methods.timeDiff(now)).toEqual( + moment(now).fromNow() + ) + }) + it(`yourValidators`, () => { expect( TabMyDelegations.computed.yourValidators({ From 26503d6d658439c93a9ab739bd0e18482b05da31 Mon Sep 17 00:00:00 2001 From: Karoly Albert Szabo Date: Thu, 13 Dec 2018 13:29:17 +0100 Subject: [PATCH 05/99] add header to first table, change title on second one (shall we just remove it?) Signed-off-by: Karoly Albert Szabo --- .../components/staking/TabMyDelegations.vue | 8 +++++++- .../staking/TabMyDelegations.spec.js | 2 +- .../TabMyDelegations.spec.js.snap | 19 +++++++++++++++++-- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/app/src/renderer/components/staking/TabMyDelegations.vue b/app/src/renderer/components/staking/TabMyDelegations.vue index 2bbacd7a3f..ba62170176 100644 --- a/app/src/renderer/components/staking/TabMyDelegations.vue +++ b/app/src/renderer/components/staking/TabMyDelegations.vue @@ -1,6 +1,12 @@ + + diff --git a/app/src/renderer/components/governance/PageProposal.vue b/app/src/renderer/components/governance/PageProposal.vue index 8c20e967d7..4a51532bc3 100644 --- a/app/src/renderer/components/governance/PageProposal.vue +++ b/app/src/renderer/components/governance/PageProposal.vue @@ -1,5 +1,5 @@ - - From 189095f56f11050f9650ef470ba7b7988fbd51cf Mon Sep 17 00:00:00 2001 From: Jordan Bibla Date: Mon, 17 Dec 2018 13:14:39 -0500 Subject: [PATCH 20/99] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a624350a54..414b9984a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - [\#1683](https://github.com/cosmos/voyager/issues/1683) Governance: block voting twice for the same option @sabau - [\#1748](https://github.com/cosmos/voyager/issues/1748) display governance parameters on tab @fedekunze - [\#1660](https://github.com/cosmos/voyager/issues/1660) Add parameters and pool to store @fedekunze +- [\#1674](https://github.com/cosmos/voyager/issues/1674) Add PageProfile component with shared styles for validator and proposal profiles @jbibla ### Changed From ae3b1d64d1634465b472a9903c209a0686e51206 Mon Sep 17 00:00:00 2001 From: Karoly Albert Szabo Date: Mon, 17 Dec 2018 19:55:28 +0100 Subject: [PATCH 21/99] localized data into project folder, to help with automation of many nodes Signed-off-by: Karoly Albert Szabo --- CHANGELOG.md | 1 + README.md | 8 ++++++++ app/src/root.js | 9 +++++---- tasks/build/local/helper.js | 37 +++++++++++++++++++++++++++---------- tasks/testnet.js | 34 +++++++++++++++++++++++----------- test/e2e/launch.js | 35 ++++++----------------------------- 6 files changed, 70 insertions(+), 54 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0254bf6e7a..b8640b8914 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Added compatibility to Gaia/SDK version 0.28.0-rc2 @faboweb - [\#1673](https://github.com/cosmos/voyager/issues/1673) Documentation and single command to run one or all tests with fallback for end to end test @sabau - [\#1683](https://github.com/cosmos/voyager/issues/1683) Governance: block voting twice for the same option @sabau +- [\#1661](https://github.com/cosmos/voyager/issues/1661) Boot: multinode available for local-testnet @sabau ### Changed diff --git a/README.md b/README.md index abcb0ed3eb..440555feff 100644 --- a/README.md +++ b/README.md @@ -267,6 +267,14 @@ $ yarn start local-testnet Import the account with the 12 word seed phrase you wrote down earlier. +### Run several nodes + +This command will build and run several nodes at once. All nodes will be validators: + +```bash +$ yarn start local-testnet 5 +``` + ## Flags A list of all environment variables and their purpose: diff --git a/app/src/root.js b/app/src/root.js index 6ab4d67885..d649913770 100644 --- a/app/src/root.js +++ b/app/src/root.js @@ -5,14 +5,15 @@ const { COSMOS_HOME, NODE_ENV } = process.env if (COSMOS_HOME) { module.exports = COSMOS_HOME } else { - const home = require(`user-home`) - const { join } = require(`path`) + const { resolve, join } = require(`path`) const networkName = require(`./network.js`).name + const appDir = resolve(`${__dirname}/../../`) + const buildTestnetPath = join(appDir, `builds`, `testnets`) const { name } = require(`../../package.json`) const DEV = NODE_ENV === `development` const appName = name.toLowerCase() - const appDirName = `.${appName}${DEV ? `-dev` : ``}` + const appDirName = `${appName}${DEV ? `-dev` : ``}` - module.exports = join(home, appDirName, networkName) + module.exports = join(buildTestnetPath, networkName, appDirName) } diff --git a/tasks/build/local/helper.js b/tasks/build/local/helper.js index c38c20d0ab..59645a366f 100644 --- a/tasks/build/local/helper.js +++ b/tasks/build/local/helper.js @@ -1,7 +1,7 @@ "use strict" const fs = require(`fs-extra`) -const path = require(`path`) +const { join } = require(`path`) const { startLocalNode, getNodeId, @@ -10,6 +10,7 @@ const { createKey, initGenesis, makeExec, + getKeys, nodeBinary } = require(`../../gaia`) @@ -44,8 +45,8 @@ Default account: // save the version of the currently used gaia into the newly created network config folder const saveVersion = nodeHome => { - const versionPath = path.join(nodeHome, `config`) - let versionFilePath = path.join(versionPath, `gaiaversion.txt`) // nodeHome/config is used to copy created config files from + const versionPath = join(nodeHome, `config`) + let versionFilePath = join(versionPath, `gaiaversion.txt`) // nodeHome/config is used to copy created config files from return makeExec( `mkdir -p ${versionPath} && ${nodeBinary} version > ${versionFilePath}` ) @@ -82,8 +83,8 @@ const buildNodes = async ( numberNodes = 1, isTest = false ) => { - const cliHomePrefix = path.join(targetDir, `cli_home`) - const nodeHomePrefix = path.join(targetDir, `node_home`) + const cliHomePrefix = join(targetDir, `cli_home`) + const nodeHomePrefix = join(targetDir, `node_home`) fs.removeSync(targetDir) // fs.removeSync(`${os.home}/.cosmos-voyager-dev/${network}`) @@ -135,10 +136,7 @@ async function setupLocalNode( options.overwrite ) mainGenesis && - (await fs.writeJSON( - path.join(nodeHome, `config`, `genesis.json`), - mainGenesis - )) + (await fs.writeJSON(join(nodeHome, `config`, `genesis.json`), mainGenesis)) await adjustConfig(nodeHome, isTest) return await getNodeId(nodeHome) @@ -147,7 +145,7 @@ async function setupLocalNode( // declare candidacy for node function adjustConfig(nodeHome, isTest = false, strictAddressbook = false) { - const configPath = path.join(nodeHome, `config`, `config.toml`) + const configPath = join(nodeHome, `config`, `config.toml`) let configToml = fs.readFileSync(configPath, `utf8`) const timeouts = [ @@ -198,9 +196,28 @@ function adjustConfig(nodeHome, isTest = false, strictAddressbook = false) { fs.writeFileSync(configPath, updatedConfigToml, `utf8`) } +const setupAccounts = async (srcClientDir, dstClientDir, options) => { + // use the master account that holds funds from node 1 + // to use it, we copy the key database from node one to our Voyager cli config folder + fs.copySync(srcClientDir, dstClientDir) + + // this account is later used to send funds to, to test token sending + await createKey({ + keyName: (options && options.keyName) || `testreceiver`, + password: (options && options.password) || `1234567890`, + clientHomeDir: dstClientDir + }) + + let accounts = await getKeys(dstClientDir) + console.log(`setup test accounts`, accounts) + + return accounts +} + module.exports = { buildLocalNode, buildNodes, saveVersion, + setupAccounts, startNodes } diff --git a/tasks/testnet.js b/tasks/testnet.js index deb56c3099..59269026b0 100644 --- a/tasks/testnet.js +++ b/tasks/testnet.js @@ -2,10 +2,15 @@ let runner = require(`./runner.js`) let config = require(`../app/src/config.js`) -const path = require(`path`) -const { startNodes, buildNodes } = require(`./build/local/helper`) -const appDir = path.resolve(`${__dirname}/../`) -const buildTestnetPath = path.join(appDir, `builds`, `testnets`) +const fs = require(`fs-extra`) +const { join, resolve } = require(`path`) +const { + startNodes, + buildNodes, + setupAccounts +} = require(`./build/local/helper`) +const appDir = resolve(`${__dirname}/../`) +const buildTestnetPath = join(appDir, `builds`, `testnets`) async function main() { const network = process.argv[2] || config.default_network @@ -15,12 +20,8 @@ async function main() { let networkPath = `./app/networks/${network}/` if (network === `local-testnet`) { - extendedEnv = { - LCD_URL: `https://localhost:9070`, - RPC_URL: `http://localhost:26657` - } - const { nodes, mainAccountSignInfo } = await buildNodes( - path.join(buildTestnetPath, network), + const { cliHomePrefix, nodes, mainAccountSignInfo } = await buildNodes( + join(buildTestnetPath, network), { chainId: network, password: `1234567890`, @@ -31,7 +32,18 @@ async function main() { numberNodes ) await startNodes(nodes, mainAccountSignInfo, network) - networkPath = path.join(nodes[1].home, `config`) + fs.copySync(join(nodes[1].home, `config`), cliHomePrefix) + let { version } = require(`../package.json`) + fs.writeFileSync(`${cliHomePrefix}/app_version`, version) + networkPath = cliHomePrefix // join(nodes[1].home, `config`) + extendedEnv = { + LCD_URL: `https://localhost:9070`, + RPC_URL: `http://localhost:26657`, + COSMOS_HOME: cliHomePrefix + } + await setupAccounts(nodes[1].cliHome, join(cliHomePrefix, `lcd`), { + keyName: `local-test` + }) } // run Voyager in a development environment diff --git a/test/e2e/launch.js b/test/e2e/launch.js index 955713c6f2..4720ce5f44 100644 --- a/test/e2e/launch.js +++ b/test/e2e/launch.js @@ -5,19 +5,14 @@ let test = require(`tape-promise/tape`) let electron = require(`electron`) let { join } = require(`path`) let fs = require(`fs-extra`) -const buildNodes = require(`../../tasks/build/local/helper`).buildNodes -const startNodes = require(`../../tasks/build/local/helper`).startNodes +const { + setupAccounts, + buildNodes, + startNodes +} = require(`../../tasks/build/local/helper`) +let { cliBinary, nodeBinary, defaultStartPort } = require(`../../tasks/gaia.js`) const testDir = join(__dirname, `..`, `..`, `testArtifacts`) -let { - createKey, - getKeys, - - cliBinary, - nodeBinary, - defaultStartPort -} = require(`../../tasks/gaia.js`) - let app, started, crashed /* @@ -119,24 +114,6 @@ const bootLocalNetwork = async (targetDir, options) => { } } -async function setupAccounts(nodeOneClientDir, voyagerCLIDir) { - // use the master account that holds funds from node 1 - // to use it, we copy the key database from node one to our Voyager cli config folde - fs.copySync(nodeOneClientDir, voyagerCLIDir) - - // this account is later used to send funds to, to test token sending - await createKey({ - keyName: `testreceiver`, - password: `1234567890`, - clientHomeDir: voyagerCLIDir - }) - - let accounts = await getKeys(voyagerCLIDir) - console.log(`setup test accounts`, accounts) - - return accounts -} - async function stop(app) { console.log(`Stopping app`) if (app && app.isRunning()) { From d5d15af3c216086d3d0358bc66ac6112b5abefd0 Mon Sep 17 00:00:00 2001 From: Jordan Bibla Date: Mon, 17 Dec 2018 14:06:44 -0500 Subject: [PATCH 22/99] fixed tests, snapshots, and lint errors --- .../components/common/PageProfile.vue | 2 +- test/e2e/governance.js | 4 +- .../components/common/PageProfile.spec.js | 13 ++ .../__snapshots__/PageProfile.spec.js.snap | 32 +++ .../__snapshots__/PageProposal.spec.js.snap | 48 ++-- .../components/staking/PageValidator.spec.js | 18 +- .../__snapshots__/PageValidator.spec.js.snap | 215 ++++++++---------- 7 files changed, 167 insertions(+), 165 deletions(-) create mode 100644 test/unit/specs/components/common/PageProfile.spec.js create mode 100644 test/unit/specs/components/common/__snapshots__/PageProfile.spec.js.snap diff --git a/app/src/renderer/components/common/PageProfile.vue b/app/src/renderer/components/common/PageProfile.vue index 4dd5f3f0e2..f5f0853f62 100644 --- a/app/src/renderer/components/common/PageProfile.vue +++ b/app/src/renderer/components/common/PageProfile.vue @@ -14,7 +14,7 @@ import { TmPageHeader } from "@tendermint/ui" export default { - name: "page-profile", + name: `page-profile`, components: { TmPageHeader } diff --git a/test/e2e/governance.js b/test/e2e/governance.js index a58f127279..b45d829100 100644 --- a/test/e2e/governance.js +++ b/test/e2e/governance.js @@ -92,7 +92,7 @@ test(`Governance`, async function(t) { .$(`dd`) let amount = parseInt((await deposit().getText()).split(` `)[0]) await t.ok( - await app.client.$(`.validator-profile__status.yellow`).isVisible(), + await app.client.$(`.page-profile__status.yellow`).isVisible(), `the proposal is open for deposits` ) await app.client.$(`#deposit-btn`).click() @@ -130,7 +130,7 @@ test(`Governance`, async function(t) { t.test(`vote`, async function(t) { await t.ok( - await app.client.$(`.validator-profile__status.green`).isVisible(), + await app.client.$(`.page-profile__status.green`).isVisible(), `the proposal is open for voting` ) await app.client.$(`#vote-btn`).click() diff --git a/test/unit/specs/components/common/PageProfile.spec.js b/test/unit/specs/components/common/PageProfile.spec.js new file mode 100644 index 0000000000..02632f601d --- /dev/null +++ b/test/unit/specs/components/common/PageProfile.spec.js @@ -0,0 +1,13 @@ +import { mount } from "@vue/test-utils" +import PageProfile from "renderer/components/common/PageProfile" + +describe("PageProfile", () => { + let wrapper + beforeEach(() => { + wrapper = mount(PageProfile) + }) + + it("has the expected html structure", () => { + expect(wrapper.vm.$el).toMatchSnapshot() + }) +}) diff --git a/test/unit/specs/components/common/__snapshots__/PageProfile.spec.js.snap b/test/unit/specs/components/common/__snapshots__/PageProfile.spec.js.snap new file mode 100644 index 0000000000..566e9d1f10 --- /dev/null +++ b/test/unit/specs/components/common/__snapshots__/PageProfile.spec.js.snap @@ -0,0 +1,32 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`PageProfile has the expected html structure 1`] = ` +
+
+
+
+ + + +
+ +
+
+
+
+ +
+
+`; diff --git a/test/unit/specs/components/governance/__snapshots__/PageProposal.spec.js.snap b/test/unit/specs/components/governance/__snapshots__/PageProposal.spec.js.snap index 69c3152752..c20b183d8b 100644 --- a/test/unit/specs/components/governance/__snapshots__/PageProposal.spec.js.snap +++ b/test/unit/specs/components/governance/__snapshots__/PageProposal.spec.js.snap @@ -2,7 +2,7 @@ exports[`PageProposal has the expected html structure 1`] = `
+
Proposal Title (#1) @@ -160,7 +161,7 @@ exports[`PageProposal has the expected html structure 1`] = `
@@ -197,7 +198,7 @@ exports[`PageProposal has the expected html structure 1`] = `
-
-
-
-
-
-
`; exports[`PageProposal shows an error if the proposal couldn't be found 1`] = `
+
diff --git a/test/unit/specs/components/staking/PageValidator.spec.js b/test/unit/specs/components/staking/PageValidator.spec.js index 2338bc2a1d..168847063f 100644 --- a/test/unit/specs/components/staking/PageValidator.spec.js +++ b/test/unit/specs/components/staking/PageValidator.spec.js @@ -156,7 +156,7 @@ describe(`PageValidator`, () => { ratio: 0.01 }) wrapper.update() - expect(wrapper.find(`#validator-profile__self-bond`).text()).toBe(`1.00 %`) + expect(wrapper.find(`#page-profile__self-bond`).text()).toBe(`1.00 %`) }) it(`should show the validator status`, () => { @@ -191,7 +191,7 @@ describe(`PageValidator`, () => { // }) // ] // wrapper.update() - // expect(wrapper.find("#validator-profile__commission").classes()).toContain( + // expect(wrapper.find("#page-profile__commission").classes()).toContain( // "green" // ) // @@ -201,7 +201,7 @@ describe(`PageValidator`, () => { // }) // ] // wrapper.update() - // expect(wrapper.find("#validator-profile__commission").classes()).toContain( + // expect(wrapper.find("#page-profile__commission").classes()).toContain( // "yellow" // ) // @@ -211,7 +211,7 @@ describe(`PageValidator`, () => { // }) // ] // wrapper.update() - // expect(wrapper.find("#validator-profile__commission").classes()).toContain( + // expect(wrapper.find("#page-profile__commission").classes()).toContain( // "red" // ) // @@ -222,7 +222,7 @@ describe(`PageValidator`, () => { // }) // ] // wrapper.update() - // expect(wrapper.find("#validator-profile__power").classes()).toContain("red") + // expect(wrapper.find("#page-profile__power").classes()).toContain("red") // // store.state.delegates.delegates = [ // Object.assign({}, delegate, { @@ -230,7 +230,7 @@ describe(`PageValidator`, () => { // }) // ] // wrapper.update() - // expect(wrapper.find("#validator-profile__power").classes()).toContain( + // expect(wrapper.find("#page-profile__power").classes()).toContain( // "yellow" // ) // @@ -240,7 +240,7 @@ describe(`PageValidator`, () => { // }) // ] // wrapper.update() - // expect(wrapper.find("#validator-profile__power").classes()).toContain( + // expect(wrapper.find("#page-profile__power").classes()).toContain( // "green" // ) // }) @@ -253,7 +253,7 @@ describe(`PageValidator`, () => { ] wrapper.update() expect(wrapper.vm.status).toMatchSnapshot() - // expect(wrapper.find(".validator-profile__status").classes()).toContain( + // expect(wrapper.find(".page-profile__status").classes()).toContain( // "yellow" // ) }) @@ -266,7 +266,7 @@ describe(`PageValidator`, () => { ] wrapper.update() wrapper.vm.status = expect(wrapper.vm.status).toMatchSnapshot() - // expect(wrapper.find(".validator-profile__status").classes()).toContain( + // expect(wrapper.find(".page-profile__status").classes()).toContain( // "red" // ) }) diff --git a/test/unit/specs/components/staking/__snapshots__/PageValidator.spec.js.snap b/test/unit/specs/components/staking/__snapshots__/PageValidator.spec.js.snap index ed831fb0dd..09bf95403d 100644 --- a/test/unit/specs/components/staking/__snapshots__/PageValidator.spec.js.snap +++ b/test/unit/specs/components/staking/__snapshots__/PageValidator.spec.js.snap @@ -2,7 +2,7 @@ exports[`PageValidator has the expected html structure 1`] = `
+
herr_schmidt_revoked @@ -195,7 +196,7 @@ exports[`PageValidator has the expected html structure 1`] = `
`; exports[`PageValidator shows a default avatar 1`] = `
+
herr_schmidt_revoked @@ -714,7 +694,7 @@ exports[`PageValidator shows a default avatar 1`] = `
" `; @@ -278,6 +284,12 @@ exports[`PageGovernance has the expected html structure 1`] = `
+
+
+
+
+
+
" `; diff --git a/test/unit/specs/components/staking/__snapshots__/PageStaking.spec.js.snap b/test/unit/specs/components/staking/__snapshots__/PageStaking.spec.js.snap index ee2100dd2d..adb3dc19b4 100644 --- a/test/unit/specs/components/staking/__snapshots__/PageStaking.spec.js.snap +++ b/test/unit/specs/components/staking/__snapshots__/PageStaking.spec.js.snap @@ -138,6 +138,12 @@ exports[`PageStaking has the expected html structure 1`] = `
+
+
+
+
+
+
" `; From 7334eaa45ff3cb024d5c814802e0a0f78542c456 Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Wed, 19 Dec 2018 13:05:51 -0300 Subject: [PATCH 27/99] fix not available coin bug on txs --- .../components/governance/ModalDeposit.vue | 12 +- .../components/governance/ModalPropose.vue | 14 +- .../components/governance/PageGovernance.vue | 16 +- .../components/governance/PageProposal.vue | 10 +- .../vuex/modules/governance/parameters.js | 5 + app/src/renderer/vuex/modules/parameters.js | 5 + app/src/renderer/vuex/modules/pool.js | 4 +- .../cli_home_1/keys/keys.db/000002.ldb | Bin 0 -> 478 bytes .../cli_home_1/keys/keys.db/000003.log | 0 .../testnets/cli_home_1/keys/keys.db/CURRENT | 1 + .../cli_home_1/keys/keys.db/CURRENT.bak | 1 + .../testnets/cli_home_1/keys/keys.db/LOCK | 0 .../testnets/cli_home_1/keys/keys.db/LOG | 16 ++ .../cli_home_1/keys/keys.db/MANIFEST-000004 | Bin 0 -> 219 bytes .../testnets/node_home_1/config/config.toml | 249 ++++++++++++++++++ .../testnets/node_home_1/config/gaiad.toml | 7 + .../node_home_1/config/gaiaversion.txt | 1 + .../testnets/node_home_1/config/genesis.json | 180 +++++++++++++ ...f092a72aea073694219496c2e0b2a1f442860.json | 41 +++ .../testnets/node_home_1/config/node_key.json | 6 + .../node_home_1/config/priv_validator.json | 14 + 21 files changed, 551 insertions(+), 31 deletions(-) create mode 100644 tasks/builds/testnets/cli_home_1/keys/keys.db/000002.ldb create mode 100644 tasks/builds/testnets/cli_home_1/keys/keys.db/000003.log create mode 100644 tasks/builds/testnets/cli_home_1/keys/keys.db/CURRENT create mode 100644 tasks/builds/testnets/cli_home_1/keys/keys.db/CURRENT.bak create mode 100644 tasks/builds/testnets/cli_home_1/keys/keys.db/LOCK create mode 100644 tasks/builds/testnets/cli_home_1/keys/keys.db/LOG create mode 100644 tasks/builds/testnets/cli_home_1/keys/keys.db/MANIFEST-000004 create mode 100644 tasks/builds/testnets/node_home_1/config/config.toml create mode 100644 tasks/builds/testnets/node_home_1/config/gaiad.toml create mode 100644 tasks/builds/testnets/node_home_1/config/gaiaversion.txt create mode 100644 tasks/builds/testnets/node_home_1/config/genesis.json create mode 100644 tasks/builds/testnets/node_home_1/config/gentx/gentx-dc2f092a72aea073694219496c2e0b2a1f442860.json create mode 100644 tasks/builds/testnets/node_home_1/config/node_key.json create mode 100644 tasks/builds/testnets/node_home_1/config/priv_validator.json diff --git a/app/src/renderer/components/governance/ModalDeposit.vue b/app/src/renderer/components/governance/ModalDeposit.vue index 738ef85664..747c1120fb 100644 --- a/app/src/renderer/components/governance/ModalDeposit.vue +++ b/app/src/renderer/components/governance/ModalDeposit.vue @@ -25,18 +25,11 @@ type="text" readonly="readonly" /> - + @@ -115,7 +108,6 @@ export default { showPassword: false }), computed: { - // TODO: get coin denom from governance params ...mapGetters([`wallet`]), balance() { // TODO: refactor to get the selected coin when multicooin deposit is enabled diff --git a/app/src/renderer/components/governance/ModalPropose.vue b/app/src/renderer/components/governance/ModalPropose.vue index 5d6f4e6311..abd41e34db 100644 --- a/app/src/renderer/components/governance/ModalPropose.vue +++ b/app/src/renderer/components/governance/ModalPropose.vue @@ -56,17 +56,11 @@ type="text" readonly="readonly" /> - + @@ -116,7 +110,6 @@ import { TmBtn, TmField, TmFormGroup, TmFormMsg } from "@tendermint/ui" const isValid = type => type === `Text` || type === `ParameterChange` || type === `SoftwareUpgrade` - const notBlank = text => !isEmpty(trim(text)) const isInteger = amount => Number.isInteger(amount) @@ -151,7 +144,6 @@ export default { showPassword: false }), computed: { - // TODO: get coin denom from governance params ...mapGetters([`wallet`]), balance() { // TODO: refactor to get the selected coin when multicoin deposit is enabled @@ -184,7 +176,7 @@ export default { amount: { required, isInteger, - between: between(1, this.balance > 0 ? this.balance : 1) + between: between(1, this.balance > 0 ? this.balance : null) }, password: { required diff --git a/app/src/renderer/components/governance/PageGovernance.vue b/app/src/renderer/components/governance/PageGovernance.vue index d0ad1f6af6..9ef2c6b11c 100644 --- a/app/src/renderer/components/governance/PageGovernance.vue +++ b/app/src/renderer/components/governance/PageGovernance.vue @@ -20,7 +20,7 @@ @@ -64,8 +64,16 @@ export default { showModalPropose: false }), computed: { - // TODO: get min deposit denom from gov params - ...mapGetters([`proposals`, `filters`, `bondingDenom`, `connected`]) + ...mapGetters([ + `proposals`, + `filters`, + `bondingDenom`, + `connected`, + `governanceParameters` + ]), + depositDenom() { + return this.governanceParameters.parameters.deposit.min_deposit[0].denom + } }, mounted() { this.ps = new PerfectScrollbar(this.$el.querySelector(`.tm-page-main`)) @@ -85,7 +93,7 @@ export default { type, initial_deposit: [ { - denom: this.bondingDenom, + denom: this.depositDenom, amount: String(amount) } ], diff --git a/app/src/renderer/components/governance/PageProposal.vue b/app/src/renderer/components/governance/PageProposal.vue index 4a51532bc3..df098643f7 100644 --- a/app/src/renderer/components/governance/PageProposal.vue +++ b/app/src/renderer/components/governance/PageProposal.vue @@ -111,7 +111,7 @@ :show-modal-deposit.sync="showModalDeposit" :proposal-id="proposalId" :proposal-title="proposal.title" - :denom="bondingDenom" + :denom="depositDenom" @submitDeposit="deposit" /> { } const actions = { + async reconnected({ state, dispatch }) { + if (state.loading) { + await dispatch(`getGovParameters`) + } + }, async getGovParameters({ state, commit, rootState }) { state.loading = true diff --git a/app/src/renderer/vuex/modules/parameters.js b/app/src/renderer/vuex/modules/parameters.js index 5f4f51d4da..1aa543ea77 100644 --- a/app/src/renderer/vuex/modules/parameters.js +++ b/app/src/renderer/vuex/modules/parameters.js @@ -16,6 +16,11 @@ export default ({ node }) => { } const actions = { + async reconnected({ state, dispatch }) { + if (state.loading) { + await dispatch(`getStakingParameters`) + } + }, async getStakingParameters({ state, commit, rootState }) { state.loading = true diff --git a/app/src/renderer/vuex/modules/pool.js b/app/src/renderer/vuex/modules/pool.js index e3a8880997..8ca6a679ea 100644 --- a/app/src/renderer/vuex/modules/pool.js +++ b/app/src/renderer/vuex/modules/pool.js @@ -16,9 +16,9 @@ export default ({ node }) => { } const actions = { - reconnected({ state, dispatch }) { + async reconnected({ state, dispatch }) { if (state.loading) { - dispatch(`getPool`) + await dispatch(`getPool`) } }, async getPool({ state, commit, rootState }) { diff --git a/tasks/builds/testnets/cli_home_1/keys/keys.db/000002.ldb b/tasks/builds/testnets/cli_home_1/keys/keys.db/000002.ldb new file mode 100644 index 0000000000000000000000000000000000000000..2ae17380c32d4e73c60daa097f6e3073e022a4d2 GIT binary patch literal 478 zcmbQi{2`ISmNz-SI5)r8Fx|{3H>WJMq&PRXBqu#9BhSDx)uOT}r_w0hxU|T~BBi)2 zxx!R0F(suawYZp(i2)2si&Km85_41aGV{{%8AMkxp$ITCGB7ZzE39DRT`OwK#Zk(u z_rXUr!4UDw5 z^8?I1T~iGWT#ZZ%b0Z?6T!NGQ{4Byf!z;2&J^cN=a!QO0GYT@@BLiK_xSS%rvVye( zLJT6j%ia7Py-VG-JzOLFoGpyPD^n_r{EYO2inCk{Y`JWG%L|gZ7+3P>0=2F#03QXB{_o5}nM;vx*3%w>%KIT;#C Jty1cK8vw*bh57&h literal 0 HcmV?d00001 diff --git a/tasks/builds/testnets/cli_home_1/keys/keys.db/000003.log b/tasks/builds/testnets/cli_home_1/keys/keys.db/000003.log new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tasks/builds/testnets/cli_home_1/keys/keys.db/CURRENT b/tasks/builds/testnets/cli_home_1/keys/keys.db/CURRENT new file mode 100644 index 0000000000..cacca7574c --- /dev/null +++ b/tasks/builds/testnets/cli_home_1/keys/keys.db/CURRENT @@ -0,0 +1 @@ +MANIFEST-000004 diff --git a/tasks/builds/testnets/cli_home_1/keys/keys.db/CURRENT.bak b/tasks/builds/testnets/cli_home_1/keys/keys.db/CURRENT.bak new file mode 100644 index 0000000000..feda7d6b24 --- /dev/null +++ b/tasks/builds/testnets/cli_home_1/keys/keys.db/CURRENT.bak @@ -0,0 +1 @@ +MANIFEST-000000 diff --git a/tasks/builds/testnets/cli_home_1/keys/keys.db/LOCK b/tasks/builds/testnets/cli_home_1/keys/keys.db/LOCK new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tasks/builds/testnets/cli_home_1/keys/keys.db/LOG b/tasks/builds/testnets/cli_home_1/keys/keys.db/LOG new file mode 100644 index 0000000000..c6fe1cc9a6 --- /dev/null +++ b/tasks/builds/testnets/cli_home_1/keys/keys.db/LOG @@ -0,0 +1,16 @@ +=============== Dec 19, 2018 (-03) =============== +12:29:14.496300 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed +12:29:14.497111 db@open opening +12:29:14.497398 version@stat F·[] S·0B[] Sc·[] +12:29:14.497816 db@janitor F·2 G·0 +12:29:14.497861 db@open done T·728.141µs +=============== Dec 19, 2018 (-03) =============== +12:29:14.836150 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed +12:29:14.836413 version@stat F·[] S·0B[] Sc·[] +12:29:14.836439 db@open opening +12:29:14.836515 journal@recovery F·1 +12:29:14.836636 journal@recovery recovering @1 +12:29:14.837227 memdb@flush created L0@2 N·2 S·478B "cos..ess,v2":"use..nfo,v1" +12:29:14.837659 version@stat F·[1] S·478B[478B] Sc·[0.25] +12:29:14.839159 db@janitor F·3 G·0 +12:29:14.839194 db@open done T·2.741569ms diff --git a/tasks/builds/testnets/cli_home_1/keys/keys.db/MANIFEST-000004 b/tasks/builds/testnets/cli_home_1/keys/keys.db/MANIFEST-000004 new file mode 100644 index 0000000000000000000000000000000000000000..78018e82ad9b9294865633d558277348c238d968 GIT binary patch literal 219 zcmZ1#xoPbc21Z7yoYb<^oRlOzr^=Gl^338?=ltA)#G=HK{30f1W>ywvb_S+<%(lt- z#ku*#hUsQTxjAL2CB?b9B{}I?8F>blsTP$*Ih97~#-&9@7AeJL$rYx0i76>Xsl~;N cOblQkT3Vc1l$V&Bs+XCUme0rt5v7^I0B|KjwEzGB literal 0 HcmV?d00001 diff --git a/tasks/builds/testnets/node_home_1/config/config.toml b/tasks/builds/testnets/node_home_1/config/config.toml new file mode 100644 index 0000000000..3b2de5b72d --- /dev/null +++ b/tasks/builds/testnets/node_home_1/config/config.toml @@ -0,0 +1,249 @@ +# This is a TOML config file. +# For more information, see https://github.com/toml-lang/toml + +##### main base config options ##### + +# TCP or UNIX socket address of the ABCI application, +# or the name of an ABCI application compiled in with the Tendermint binary +proxy_app = "tcp://127.0.0.1:26658" + +# A custom human readable name for this node +moniker = "local_1" + +# If this node is many blocks behind the tip of the chain, FastSync +# allows them to catchup quickly by downloading blocks in parallel +# and verifying their commits +fast_sync = true + +# Database backend: leveldb | memdb | cleveldb +db_backend = "leveldb" + +# Database directory +db_dir = "data" + +# Output level for logging, including package level options +log_level = "main:info,state:info,*:error" + +# Output format: 'plain' (colored text) or 'json' +log_format = "plain" + +##### additional base config options ##### + +# Path to the JSON file containing the initial validator set and other meta data +genesis_file = "config/genesis.json" + +# Path to the JSON file containing the private key to use as a validator in the consensus protocol +priv_validator_file = "config/priv_validator.json" + +# TCP or UNIX socket address for Tendermint to listen on for +# connections from an external PrivValidator process +priv_validator_laddr = "" + +# Path to the JSON file containing the private key to use for node authentication in the p2p protocol +node_key_file = "config/node_key.json" + +# Mechanism to connect to the ABCI application: socket | grpc +abci = "socket" + +# TCP or UNIX socket address for the profiling server to listen on +prof_laddr = "localhost:6060" + +# If true, query the ABCI app on connecting to a new peer +# so the app can decide if we should keep the connection or not +filter_peers = false + +##### advanced configuration options ##### + +##### rpc server configuration options ##### +[rpc] + +# TCP or UNIX socket address for the RPC server to listen on +laddr = "tcp://0.0.0.0:26657" + +# A list of origins a cross-domain request can be executed from +# Default value '[]' disables cors support +# Use '["*"]' to allow any origin +cors_allowed_origins = "[[]]" + +# A list of methods the client is allowed to use with cross-domain requests +cors_allowed_methods = "[[HEAD GET POST] GET POST]" + +# A list of non simple headers the client is allowed to use with cross-domain requests +cors_allowed_headers = "[[Origin Accept Content-Type X-Requested-With X-Server-Time] Accept Content-Type X-Requested-With X-Server-Time]" + +# TCP or UNIX socket address for the gRPC server to listen on +# NOTE: This server only supports /broadcast_tx_commit +grpc_laddr = "" + +# Maximum number of simultaneous connections. +# Does not include RPC (HTTP&WebSocket) connections. See max_open_connections +# If you want to accept more significant number than the default, make sure +# you increase your OS limits. +# 0 - unlimited. +# Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files} +# 1024 - 40 - 10 - 50 = 924 = ~900 +grpc_max_open_connections = 900 + +# Activate unsafe RPC commands like /dial_seeds and /unsafe_flush_mempool +unsafe = false + +# Maximum number of simultaneous connections (including WebSocket). +# Does not include gRPC connections. See grpc_max_open_connections +# If you want to accept more significant number than the default, make sure +# you increase your OS limits. +# 0 - unlimited. +# Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files} +# 1024 - 40 - 10 - 50 = 924 = ~900 +max_open_connections = 900 + +##### peer to peer configuration options ##### +[p2p] + +# Address to listen for incoming connections +laddr = "tcp://0.0.0.0:26656" + +# Address to advertise to peers for them to dial +# If empty, will use the same port as the laddr, +# and will introspect on the listener or use UPnP +# to figure out the address. +external_address = "" + +# Comma separated list of seed nodes to connect to +seeds = "" + +# Comma separated list of nodes to keep persistent connections to +persistent_peers = "" + +# UPNP port forwarding +upnp = false + +# Path to address book +addr_book_file = "config/addrbook.json" + +# Set true for strict address routability rules +# Set false for private or local networks +addr_book_strict = true + +# Maximum number of inbound peers +max_num_inbound_peers = 40 + +# Maximum number of outbound peers to connect to, excluding persistent peers +max_num_outbound_peers = 10 + +# Time to wait before flushing messages out on the connection +flush_throttle_timeout = "100ms" + +# Maximum size of a message packet payload, in bytes +max_packet_msg_payload_size = 1024 + +# Rate at which packets can be sent, in bytes/second +send_rate = 5120000 + +# Rate at which packets can be received, in bytes/second +recv_rate = 5120000 + +# Set true to enable the peer-exchange reactor +pex = true + +# Seed mode, in which node constantly crawls the network and looks for +# peers. If another node asks it for addresses, it responds and disconnects. +# +# Does not work if the peer-exchange reactor is disabled. +seed_mode = false + +# Comma separated list of peer IDs to keep private (will not be gossiped to other peers) +private_peer_ids = "" + +# Toggle to disable guard against peers connecting from the same ip. +allow_duplicate_ip = true + +# Peer connection configuration. +handshake_timeout = "20s" +dial_timeout = "3s" + +##### mempool configuration options ##### +[mempool] + +recheck = true +broadcast = true +wal_dir = "" + +# size of the mempool +size = 5000 + +# size of the cache (used to filter transactions we saw earlier) +cache_size = 10000 + +##### consensus configuration options ##### +[consensus] + +wal_file = "data/cs.wal/wal" + +timeout_propose = "3s" +timeout_propose_delta = "500ms" +timeout_prevote = "1s" +timeout_prevote_delta = "500ms" +timeout_precommit = "1s" +timeout_precommit_delta = "500ms" +timeout_commit = "5s" + +# Make progress as soon as we have all the precommits (as if TimeoutCommit = 0) +skip_timeout_commit = false + +# EmptyBlocks mode and possible interval between empty blocks +create_empty_blocks = true +create_empty_blocks_interval = "0s" + +# Reactor sleep duration parameters +peer_gossip_sleep_duration = "100ms" +peer_query_maj23_sleep_duration = "2s" + +# Block time parameters. Corresponds to the minimum time increment between consecutive blocks. +blocktime_iota = "1s" + +##### transactions indexer configuration options ##### +[tx_index] + +# What indexer to use for transactions +# +# Options: +# 1) "null" (default) +# 2) "kv" - the simplest possible indexer, backed by key-value storage (defaults to levelDB; see DBBackend). +indexer = "kv" + +# Comma-separated list of tags to index (by default the only tag is "tx.hash") +# +# You can also index transactions by height by adding "tx.height" tag here. +# +# It's recommended to index only a subset of tags due to possible memory +# bloat. This is, of course, depends on the indexer's DB and the volume of +# transactions. +index_tags = "" + +# When set to true, tells indexer to index all tags (predefined tags: +# "tx.hash", "tx.height" and all tags from DeliverTx responses). +# +# Note this may be not desirable (see the comment above). IndexTags has a +# precedence over IndexAllTags (i.e. when given both, IndexTags will be +# indexed). +index_all_tags = true + +##### instrumentation configuration options ##### +[instrumentation] + +# When true, Prometheus metrics are served under /metrics on +# PrometheusListenAddr. +# Check out the documentation for the list of available metrics. +prometheus = false + +# Address to listen for Prometheus collector(s) connections +prometheus_listen_addr = ":26660" + +# Maximum number of simultaneous connections. +# If you want to accept more significant number than the default, make sure +# you increase your OS limits. +# 0 - unlimited. +max_open_connections = 3 + +# Instrumentation namespace +namespace = "tendermint" diff --git a/tasks/builds/testnets/node_home_1/config/gaiad.toml b/tasks/builds/testnets/node_home_1/config/gaiad.toml new file mode 100644 index 0000000000..dd505c2590 --- /dev/null +++ b/tasks/builds/testnets/node_home_1/config/gaiad.toml @@ -0,0 +1,7 @@ +# This is a TOML config file. +# For more information, see https://github.com/toml-lang/toml + +##### main base config options ##### + +# Validators reject any tx from the mempool with less than the minimum fee per gas. +minimum_fees = "" diff --git a/tasks/builds/testnets/node_home_1/config/gaiaversion.txt b/tasks/builds/testnets/node_home_1/config/gaiaversion.txt new file mode 100644 index 0000000000..f589efd34a --- /dev/null +++ b/tasks/builds/testnets/node_home_1/config/gaiaversion.txt @@ -0,0 +1 @@ +0.28.0-rc2-0-g945803d5 diff --git a/tasks/builds/testnets/node_home_1/config/genesis.json b/tasks/builds/testnets/node_home_1/config/genesis.json new file mode 100644 index 0000000000..4ab1deb257 --- /dev/null +++ b/tasks/builds/testnets/node_home_1/config/genesis.json @@ -0,0 +1,180 @@ +{ + "genesis_time": "2018-12-19T15:29:15.145318Z", + "chain_id": "default-testnet", + "consensus_params": { + "block_size": { + "max_bytes": "22020096", + "max_gas": "-1" + }, + "evidence": { + "max_age": "100000" + }, + "validator": { + "pub_key_types": ["ed25519"] + } + }, + "app_hash": "", + "app_state": { + "accounts": [ + { + "address": "cosmos1g62mlvetsmmtlgjhn09e8yrly2g3ur28dsvcx5", + "coins": [ + { + "denom": "STAKE", + "amount": "150" + }, + { + "denom": "localcoin", + "amount": "1000" + } + ], + "sequence_number": "0", + "account_number": "0" + } + ], + "auth": { + "collected_fees": null + }, + "stake": { + "pool": { + "loose_tokens": "150.0000000000", + "bonded_tokens": "0.0000000000" + }, + "params": { + "unbonding_time": "259200000000000", + "max_validators": 100, + "bond_denom": "STAKE" + }, + "last_total_power": "0", + "last_validator_powers": null, + "validators": null, + "bonds": null, + "unbonding_delegations": null, + "redelegations": null, + "exported": false + }, + "mint": { + "minter": { + "inflation": "0.1300000000", + "annual_provisions": "0.0000000000" + }, + "params": { + "mint_denom": "STAKE", + "inflation_rate_change": "0.1300000000", + "inflation_max": "0.2000000000", + "inflation_min": "0.0700000000", + "goal_bonded": "0.6700000000", + "blocks_per_year": "6311520" + } + }, + "distr": { + "fee_pool": { + "val_accum": { + "update_height": "0", + "accum": "0.0000000000" + }, + "val_pool": null, + "community_pool": null + }, + "community_tax": "0.0200000000", + "base_proposer_reward": "0.0100000000", + "bonus_proposer_reward": "0.0400000000", + "validator_dist_infos": null, + "delegator_dist_infos": null, + "delegator_withdraw_infos": null, + "previous_proposer": "cosmosvalcons1m46yrx" + }, + "gov": { + "starting_proposal_id": "1", + "deposits": null, + "votes": null, + "proposals": null, + "deposit_params": { + "min_deposit": [ + { + "denom": "STAKE", + "amount": "10" + } + ], + "max_deposit_period": "172800000000000" + }, + "voting_params": { + "voting_period": "172800000000000" + }, + "tally_params": { + "quorum": "0.3340000000", + "threshold": "0.5000000000", + "veto": "0.3340000000", + "governance_penalty": "0.0100000000" + } + }, + "slashing": { + "params": { + "max-evidence-age": "120000000000", + "signed-blocks-window": "100", + "min-signed-per-window": "0.5000000000", + "double-sign-unbond-duration": "300000000000", + "downtime-unbond-duration": "600000000000", + "slash-fraction-double-sign": "0.0500000000", + "slash-fraction-downtime": "0.0100000000" + }, + "signing_infos": {}, + "missed_blocks": {}, + "slashing_periods": null + }, + "gentxs": [ + { + "type": "auth/StdTx", + "value": { + "msg": [ + { + "type": "cosmos-sdk/MsgCreateValidator", + "value": { + "Description": { + "moniker": "local_1", + "identity": "", + "website": "", + "details": "" + }, + "Commission": { + "rate": "0.1000000000", + "max_rate": "0.2000000000", + "max_change_rate": "0.0100000000" + }, + "delegator_address": "cosmos1g62mlvetsmmtlgjhn09e8yrly2g3ur28dsvcx5", + "validator_address": "cosmosvaloper1g62mlvetsmmtlgjhn09e8yrly2g3ur28gycd28", + "pubkey": { + "type": "tendermint/PubKeyEd25519", + "value": "xaw5RhyeOsHRpqQbwpbkbDPvWLLMp0XAuMOxjrhBqsQ=" + }, + "delegation": { + "denom": "STAKE", + "amount": "100" + } + } + } + ], + "fee": { + "amount": [ + { + "denom": "", + "amount": "0" + } + ], + "gas": "200000" + }, + "signatures": [ + { + "pub_key": { + "type": "tendermint/PubKeySecp256k1", + "value": "Akjnzjcl9yTu2KESe36E/D2BIz360ucNS1Uucv52akJ2" + }, + "signature": "E5zW/5KQQIwg1Y4PXgDvACatm0eJxTDWW2h5fsTClttJFhV/4gGLlYhoZT6sAbTmE5ZcXzjKocB7Le/AcA23xg==" + } + ], + "memo": "dc2f092a72aea073694219496c2e0b2a1f442860@192.168.0.188:26656" + } + } + ] + } +} diff --git a/tasks/builds/testnets/node_home_1/config/gentx/gentx-dc2f092a72aea073694219496c2e0b2a1f442860.json b/tasks/builds/testnets/node_home_1/config/gentx/gentx-dc2f092a72aea073694219496c2e0b2a1f442860.json new file mode 100644 index 0000000000..42376f67fe --- /dev/null +++ b/tasks/builds/testnets/node_home_1/config/gentx/gentx-dc2f092a72aea073694219496c2e0b2a1f442860.json @@ -0,0 +1,41 @@ +{ + "type": "auth/StdTx", + "value": { + "msg": [ + { + "type": "cosmos-sdk/MsgCreateValidator", + "value": { + "Description": { + "moniker": "local_1", + "identity": "", + "website": "", + "details": "" + }, + "Commission": { + "rate": "0.1000000000", + "max_rate": "0.2000000000", + "max_change_rate": "0.0100000000" + }, + "delegator_address": "cosmos1g62mlvetsmmtlgjhn09e8yrly2g3ur28dsvcx5", + "validator_address": "cosmosvaloper1g62mlvetsmmtlgjhn09e8yrly2g3ur28gycd28", + "pubkey": { + "type": "tendermint/PubKeyEd25519", + "value": "xaw5RhyeOsHRpqQbwpbkbDPvWLLMp0XAuMOxjrhBqsQ=" + }, + "delegation": { "denom": "STAKE", "amount": "100" } + } + } + ], + "fee": { "amount": [{ "denom": "", "amount": "0" }], "gas": "200000" }, + "signatures": [ + { + "pub_key": { + "type": "tendermint/PubKeySecp256k1", + "value": "Akjnzjcl9yTu2KESe36E/D2BIz360ucNS1Uucv52akJ2" + }, + "signature": "E5zW/5KQQIwg1Y4PXgDvACatm0eJxTDWW2h5fsTClttJFhV/4gGLlYhoZT6sAbTmE5ZcXzjKocB7Le/AcA23xg==" + } + ], + "memo": "dc2f092a72aea073694219496c2e0b2a1f442860@192.168.0.188:26656" + } +} diff --git a/tasks/builds/testnets/node_home_1/config/node_key.json b/tasks/builds/testnets/node_home_1/config/node_key.json new file mode 100644 index 0000000000..56d259681f --- /dev/null +++ b/tasks/builds/testnets/node_home_1/config/node_key.json @@ -0,0 +1,6 @@ +{ + "priv_key": { + "type": "tendermint/PrivKeyEd25519", + "value": "mIJRgWx2vFFPfow0TEwPdU5VHeG69286nGN1Gf9/O9I4DoRNkNKDsdl83lDnV4rDqGE450xj4KyWQKiEVGazqw==" + } +} diff --git a/tasks/builds/testnets/node_home_1/config/priv_validator.json b/tasks/builds/testnets/node_home_1/config/priv_validator.json new file mode 100644 index 0000000000..e46ffba671 --- /dev/null +++ b/tasks/builds/testnets/node_home_1/config/priv_validator.json @@ -0,0 +1,14 @@ +{ + "address": "B49D9A0D26902D38D380DB86EC73A19E4876AEDE", + "pub_key": { + "type": "tendermint/PubKeyEd25519", + "value": "xaw5RhyeOsHRpqQbwpbkbDPvWLLMp0XAuMOxjrhBqsQ=" + }, + "last_height": "0", + "last_round": "0", + "last_step": 0, + "priv_key": { + "type": "tendermint/PrivKeyEd25519", + "value": "X+R5CqsWgZZhw04pFK19WjoF5fldqNd7o7Oe1NAA89bFrDlGHJ46wdGmpBvCluRsM+9YssynRcC4w7GOuEGqxA==" + } +} From fb00e7ebf1be00a19f9c01cb8e1644085b33bf12 Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Wed, 19 Dec 2018 17:15:19 -0300 Subject: [PATCH 28/99] tally working --- .../components/governance/LiProposal.vue | 9 +--- .../components/governance/PageProposal.vue | 50 +++++++------------ .../vuex/modules/governance/proposals.js | 35 +++++++------ 3 files changed, 39 insertions(+), 55 deletions(-) diff --git a/app/src/renderer/components/governance/LiProposal.vue b/app/src/renderer/components/governance/LiProposal.vue index a7f2aee10b..b8f1f48a20 100644 --- a/app/src/renderer/components/governance/LiProposal.vue +++ b/app/src/renderer/components/governance/LiProposal.vue @@ -49,19 +49,14 @@ export default { ...mapGetters([`proposals`]), tally() { let proposalTally - if (this.proposal.proposal_status === `VotingPeriod`) { - proposalTally = this.proposals.tallies[this.proposalId] - } else if (this.proposal.proposal_status !== `VotingPeriod`) { - proposalTally = this.proposal.tally_result - } - console.log(proposalTally) + proposalTally = this.proposals.tallies[this.proposal.proposal_id] proposalTally.yes = Math.round(parseFloat(proposalTally.yes)) proposalTally.no = Math.round(parseFloat(proposalTally.no)) proposalTally.no_with_veto = Math.round( parseFloat(proposalTally.no_with_veto) ) proposalTally.abstain = Math.round(parseFloat(proposalTally.abstain)) - return this.proposal.tally_result + return proposalTally }, status() { if (this.proposal.proposal_status === `Passed`) { diff --git a/app/src/renderer/components/governance/PageProposal.vue b/app/src/renderer/components/governance/PageProposal.vue index 707b1a7ce2..3b25e72d52 100644 --- a/app/src/renderer/components/governance/PageProposal.vue +++ b/app/src/renderer/components/governance/PageProposal.vue @@ -151,6 +151,7 @@ export default { } }, data: () => ({ + proposal: undefined, showModalDeposit: false, showModalVote: false, lastVote: undefined @@ -164,24 +165,6 @@ export default { `wallet`, `votes` ]), - proposal() { - let proposal = this.proposals.proposals[this.proposalId] - if (proposal && proposal.tally_result) { - proposal.tally_result.yes = Math.round( - parseFloat(proposal.tally_result.yes) - ) - proposal.tally_result.no = Math.round( - parseFloat(proposal.tally_result.no) - ) - proposal.tally_result.no_with_veto = Math.round( - parseFloat(proposal.tally_result.no_with_veto) - ) - proposal.tally_result.abstain = Math.round( - parseFloat(proposal.tally_result.abstain) - ) - } - return proposal - }, proposalType() { return this.proposal.proposal_type.toLowerCase() }, @@ -196,27 +179,23 @@ export default { }, totalVotes() { return ( - Number(this.proposal.tally_result.yes) + - Number(this.proposal.tally_result.no) + - Number(this.proposal.tally_result.no_with_veto) + - Number(this.proposal.tally_result.abstain) + this.tally.yes + + this.tally.no + + this.tally.no_with_veto + + this.tally.abstain ) }, yesPercentage() { - return num.percentInt(this.proposal.tally_result.yes / this.totalVotes) + return num.percentInt(this.tally.yes / this.totalVotes) }, noPercentage() { - return num.percentInt(this.proposal.tally_result.no / this.totalVotes) + return num.percentInt(this.tally.no / this.totalVotes) }, noWithVetoPercentage() { - return num.percentInt( - this.proposal.tally_result.no_with_veto / this.totalVotes - ) + return num.percentInt(this.tally.no_with_veto / this.totalVotes) }, abstainPercentage() { - return num.percentInt( - this.proposal.tally_result.abstain / this.totalVotes - ) + return num.percentInt(this.tally.abstain / this.totalVotes) }, tally() { let proposalTally @@ -231,7 +210,7 @@ export default { parseFloat(proposalTally.no_with_veto) ) proposalTally.abstain = Math.round(parseFloat(proposalTally.abstain)) - return this.proposal.tally_result + return proposalTally }, status() { if (this.proposal.proposal_status === `Passed`) @@ -260,10 +239,15 @@ export default { } } }, + mounted() { + this.proposal = this.proposals.proposals[this.proposalId] + }, + updated() { + this.proposal = this.proposals.proposals[this.proposalId] + }, methods: { async onVote() { this.showModalVote = true - // The error is already handled with notifyError in votes.js await this.$store.dispatch(`getProposalVotes`, this.proposalId) this.lastVote = @@ -282,6 +266,7 @@ export default { password }) + this.proposal = this.proposals.proposals[this.proposalId] // TODO: get min deposit denom from gov params this.$store.commit(`notify`, { title: `Successful deposit!`, @@ -306,6 +291,7 @@ export default { password }) + this.proposal = this.proposals.proposals[this.proposalId] this.$store.commit(`notify`, { title: `Successful vote!`, body: `You have successfully voted ${option} on proposal #${ diff --git a/app/src/renderer/vuex/modules/governance/proposals.js b/app/src/renderer/vuex/modules/governance/proposals.js index ec87e232c6..1557d5a1ff 100644 --- a/app/src/renderer/vuex/modules/governance/proposals.js +++ b/app/src/renderer/vuex/modules/governance/proposals.js @@ -10,15 +10,12 @@ export default ({ node }) => { tallies: {} } const state = JSON.parse(JSON.stringify(emptyState)) - const mutations = { setProposal(state, proposal) { Vue.set(state.proposals, proposal.proposal_id, proposal) }, - setProposalTally(state, proposalId, tally_result) { - if (tally_result !== undefined) { - Vue.set(state.tallies, proposalId, tally_result) - } + setProposalTally(state, { proposal_id, tally_result }) { + Vue.set(state.tallies, proposal_id, tally_result) } } let actions = { @@ -46,18 +43,15 @@ export default ({ node }) => { tally_result = await node.queryProposalTally( proposal.value.proposal_id ) - console.log(tally_result) - if (tally_result === undefined) { - tally_result = JSON.parse( - JSON.stringify(proposal.value.tally_result) - ) - } - commit( - `setProposalTally`, - proposal.value.proposal_id, - tally_result + } else { + tally_result = JSON.parse( + JSON.stringify(proposal.value.tally_result) ) } + commit(`setProposalTally`, { + proposal_id: proposal.value.proposal_id, + tally_result + }) }) ) } @@ -76,11 +70,20 @@ export default ({ node }) => { async getProposal({ state, commit }, proposal_id) { state.loading = true try { + let tally_result state.error = null state.loading = false - state.loaded = true // TODO make state for only proposal + state.loaded = true // TODO make state for single proposal let proposal = await node.queryProposal(proposal_id) commit(`setProposal`, proposal.value) + if (proposal.value.proposal_status === `VotingPeriod`) { + tally_result = await node.queryProposalTally( + proposal.value.proposal_id + ) + } else { + tally_result = JSON.parse(JSON.stringify(proposal.value.tally_result)) + } + commit(`setProposalTally`, { proposal_id, tally_result }) } catch (error) { commit(`notifyError`, { title: `Error querying proposal with id #${proposal_id}`, From fe6cf7446ab9c14a81650732a8498a26893ff8db Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Wed, 19 Dec 2018 18:35:40 -0300 Subject: [PATCH 29/99] fix module proposals tests --- app/src/renderer/connectors/lcdClientMock.js | 42 ++++++++++++--- .../specs/store/governance/proposals.spec.js | 51 ++++++++++++++----- 2 files changed, 71 insertions(+), 22 deletions(-) diff --git a/app/src/renderer/connectors/lcdClientMock.js b/app/src/renderer/connectors/lcdClientMock.js index cd1cde058c..e020a1f18a 100644 --- a/app/src/renderer/connectors/lcdClientMock.js +++ b/app/src/renderer/connectors/lcdClientMock.js @@ -450,8 +450,34 @@ let state = { } } }, + tallies: { + "1": { + yes: `500`, + no: `25`, + no_with_veto: `10`, + abstain: `56` + }, + "2": { + yes: `0`, + no: `0`, + no_with_veto: `0`, + abstain: `0` + }, + "5": { + yes: `0`, + no: `0`, + no_with_veto: `0`, + abstain: `0` + }, + "6": { + yes: `10`, + no: `30`, + no_with_veto: `100`, + abstain: `20` + } + }, votes: { - 1: [ + "1": [ { proposal_id: `1`, voter: validators[0], @@ -463,8 +489,8 @@ let state = { option: `NoWithVeto` } ], - 2: [], - 5: [ + "2": [], + "5": [ { proposal_id: `5`, voter: validators[0], @@ -476,7 +502,7 @@ let state = { option: `Abstain` } ], - 6: [ + "6": [ { proposal_id: `6`, voter: validators[0], @@ -490,7 +516,7 @@ let state = { ] }, deposits: { - 1: [ + "1": [ { proposal_id: `1`, depositor: validators[0], @@ -516,7 +542,7 @@ let state = { ] } ], - 2: [ + "2": [ { proposal_id: `2`, depositor: validators[0], @@ -528,7 +554,7 @@ let state = { ] } ], - 5: [ + "5": [ { proposal_id: `5`, depositor: validators[0], @@ -550,7 +576,7 @@ let state = { ] } ], - 6: [ + "6": [ { proposal_id: `6`, depositor: validators[0], diff --git a/test/unit/specs/store/governance/proposals.spec.js b/test/unit/specs/store/governance/proposals.spec.js index 0b3c9644eb..95ab38b25e 100644 --- a/test/unit/specs/store/governance/proposals.spec.js +++ b/test/unit/specs/store/governance/proposals.spec.js @@ -1,6 +1,6 @@ import proposalsModule from "renderer/vuex/modules/governance/proposals.js" import lcdClientMock from "renderer/connectors/lcdClientMock.js" -let proposals = lcdClientMock.state.proposals +let { proposals, tallies } = lcdClientMock.state let addresses = lcdClientMock.addresses let mockRootState = { @@ -40,10 +40,11 @@ describe(`Module: Proposals`, () => { it(`adds a tally result to a proposal already in state`, () => { let { mutations, state } = module mutations.setProposal(state, proposals[`2`]) - mutations.setProposalTally(state, `2`, proposals[`1`].tally_result) - expect(state.proposals[`2`].tally_result).toEqual( - proposals[`1`].tally_result - ) + mutations.setProposalTally(state, { + proposal_id: `2`, + tally_result: tallies[`1`] + }) + expect(state.tallies[`2`]).toEqual(tallies[`1`]) }) it(`replaces existing proposal with same id`, () => { @@ -74,7 +75,9 @@ describe(`Module: Proposals`, () => { Object.values(proposals).map(proposal => ({ value: proposal })) - ) + ), + queryProposalTally: proposal_id => + Promise.resolve(tallies[proposal_id]) } }) @@ -88,12 +91,27 @@ describe(`Module: Proposals`, () => { dispatch, rootState: mockRootState }) - expect(commit.mock.calls).toEqual([ - [`setProposal`, proposals[`1`]], - [`setProposal`, proposals[`2`]], - [`setProposal`, proposals[`5`]], - [`setProposal`, proposals[`6`]] - ]) + expect(commit.mock.calls).toEqual( + expect.arrayContaining([ + [`setProposal`, proposals[`1`]], + [ + `setProposalTally`, + { proposal_id: `1`, tally_result: tallies[`1`] } + ], + [`setProposal`, proposals[`2`]], + [ + `setProposalTally`, + { proposal_id: `2`, tally_result: tallies[`2`] } + ], + [`setProposal`, proposals[`5`]], + [ + `setProposalTally`, + { proposal_id: `5`, tally_result: tallies[`5`] } + ], + [`setProposal`, proposals[`6`]], + [`setProposalTally`, { proposal_id: `6`, tally_result: tallies[`6`] }] + ]) + ) }) it(`throws and stores error if the request fails`, async () => { @@ -117,7 +135,9 @@ describe(`Module: Proposals`, () => { module = proposalsModule({ node: { queryProposal: proposal_id => - Promise.resolve({ value: proposals[proposal_id] }) + Promise.resolve({ value: proposals[proposal_id] }), + queryProposalTally: proposal_id => + Promise.resolve(tallies[proposal_id]) } }) @@ -129,7 +149,10 @@ describe(`Module: Proposals`, () => { { state, commit, dispatch, rootState: mockRootState }, `1` ) - expect(commit.mock.calls).toEqual([[`setProposal`, proposals[`1`]]]) + expect(commit.mock.calls).toEqual([ + [`setProposal`, proposals[`1`]], + [`setProposalTally`, { proposal_id: `1`, tally_result: tallies[`1`] }] + ]) }) it(`throws and stores error if the request fails`, async () => { From 354994d606ff3edebf3c3df4c35b1f3f5bdf855c Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Wed, 19 Dec 2018 20:03:08 -0300 Subject: [PATCH 30/99] updates on tests and store --- app/src/renderer/connectors/lcdClient.js | 2 +- .../vuex/modules/governance/proposals.js | 2 +- app/src/renderer/vuex/store.js | 1 + .../components/governance/LiProposal.spec.js | 44 +++++------ .../governance/PageProposal.spec.js | 76 ++++++++++--------- .../governance/TabProposals.spec.js | 14 +++- .../governance/TableProposals.spec.js | 6 +- .../__snapshots__/PageProposal.spec.js.snap | 33 ++++---- .../__snapshots__/TabProposals.spec.js.snap | 18 ++--- .../specs/store/governance/proposals.spec.js | 3 +- 10 files changed, 103 insertions(+), 96 deletions(-) diff --git a/app/src/renderer/connectors/lcdClient.js b/app/src/renderer/connectors/lcdClient.js index 250ede86cf..2461d4abc6 100644 --- a/app/src/renderer/connectors/lcdClient.js +++ b/app/src/renderer/connectors/lcdClient.js @@ -183,7 +183,7 @@ const Client = (axios, localLcdURL, remoteLcdURL) => { true )() }, - queryProposalTally: function(proposalId) { + getProposalTally: function(proposalId) { return req(`GET`, `/gov/proposals/${proposalId}/tally`, true)() }, getGovDepositParameters: req(`GET`, `/gov/parameters/deposit`, true), diff --git a/app/src/renderer/vuex/modules/governance/proposals.js b/app/src/renderer/vuex/modules/governance/proposals.js index 1557d5a1ff..a2da64f449 100644 --- a/app/src/renderer/vuex/modules/governance/proposals.js +++ b/app/src/renderer/vuex/modules/governance/proposals.js @@ -40,7 +40,7 @@ export default ({ node }) => { proposals.map(async proposal => { commit(`setProposal`, proposal.value) if (proposal.value.proposal_status === `VotingPeriod`) { - tally_result = await node.queryProposalTally( + tally_result = await node.getProposalTally( proposal.value.proposal_id ) } else { diff --git a/app/src/renderer/vuex/store.js b/app/src/renderer/vuex/store.js index 90edd3a9b8..b3178373e0 100644 --- a/app/src/renderer/vuex/store.js +++ b/app/src/renderer/vuex/store.js @@ -36,6 +36,7 @@ export default (opts = {}) => { `setProposal`, `setProposalDeposits`, `setProposalVotes`, + `setProposalTally`, `setGovParameters`, `setKeybaseIdentities` ] diff --git a/test/unit/specs/components/governance/LiProposal.spec.js b/test/unit/specs/components/governance/LiProposal.spec.js index 367f67d71c..5f6bbcf673 100644 --- a/test/unit/specs/components/governance/LiProposal.spec.js +++ b/test/unit/specs/components/governance/LiProposal.spec.js @@ -2,7 +2,14 @@ import setup from "../../../helpers/vuex-setup" import lcdClientMock from "renderer/connectors/lcdClientMock.js" import LiProposal from "renderer/components/governance/LiProposal" -let proposal = lcdClientMock.state.proposals[`1`] +let { proposals, tallies } = lcdClientMock.state +let proposal = proposals[`1`] + +const $store = { + getters: { + proposals: { proposals, tallies } + } +} describe(`LiProposal`, () => { let wrapper @@ -10,9 +17,8 @@ describe(`LiProposal`, () => { beforeEach(() => { let instance = mount(LiProposal, { - propsData: { - proposal - } + propsData: { proposal }, + $store }) wrapper = instance.wrapper wrapper.update() @@ -25,9 +31,8 @@ describe(`LiProposal`, () => { it(`should return status info for passed proposals`, () => { proposal.proposal_status = `Passed` let { wrapper } = mount(LiProposal, { - propsData: { - proposal - } + propsData: { proposal }, + $store }) wrapper.update() expect(wrapper.vm.status).toEqual({ @@ -38,9 +43,8 @@ describe(`LiProposal`, () => { it(`should return status info for rejected proposals`, () => { proposal.proposal_status = `Rejected` let { wrapper } = mount(LiProposal, { - propsData: { - proposal - } + propsData: { proposal }, + $store }) wrapper.update() expect(wrapper.vm.status).toEqual({ @@ -52,9 +56,8 @@ describe(`LiProposal`, () => { it(`should return status info for active proposals`, () => { proposal.proposal_status = `VotingPeriod` let { wrapper } = mount(LiProposal, { - propsData: { - proposal - } + propsData: { proposal }, + $store }) wrapper.update() expect(wrapper.vm.status).toEqual({ @@ -66,9 +69,8 @@ describe(`LiProposal`, () => { it(`should return status info for 'DepositPeriod' proposals`, () => { proposal.proposal_status = `DepositPeriod` let { wrapper } = mount(LiProposal, { - propsData: { - proposal - } + propsData: { proposal }, + $store }) wrapper.update() expect(wrapper.vm.status).toEqual({ @@ -80,9 +82,8 @@ describe(`LiProposal`, () => { it(`should return status info for an unknown proposal type`, () => { proposal.proposal_status = `Unknown` let { wrapper } = mount(LiProposal, { - propsData: { - proposal - } + propsData: { proposal }, + $store }) wrapper.update() expect(wrapper.vm.status).toEqual({ @@ -98,9 +99,8 @@ describe(`LiProposal`, () => { it(`should truncate the description and add an ellipsis`, () => { proposal.description = `this is some kind of long description. longer than 100 characters for optimum-maximum-ideal truncation.` let { wrapper } = mount(LiProposal, { - propsData: { - proposal - } + propsData: { proposal }, + $store }) wrapper.update() expect(wrapper.vm.description).toEqual( diff --git a/test/unit/specs/components/governance/PageProposal.spec.js b/test/unit/specs/components/governance/PageProposal.spec.js index ec47820f00..03d928ad6a 100644 --- a/test/unit/specs/components/governance/PageProposal.spec.js +++ b/test/unit/specs/components/governance/PageProposal.spec.js @@ -8,7 +8,8 @@ import ModalDeposit from "renderer/components/governance/ModalDeposit" import ModalVote from "renderer/components/governance/ModalVote" import lcdClientMock from "renderer/connectors/lcdClientMock.js" -let proposal = lcdClientMock.state.proposals[`1`] +let { proposals, tallies } = lcdClientMock.state +let proposal = proposals[`2`] describe(`PageProposal`, () => { let wrapper, store @@ -17,7 +18,8 @@ describe(`PageProposal`, () => { const $store = { commit: jest.fn(), - dispatch: jest.fn() + dispatch: jest.fn(), + getters: { proposals: { proposals, tallies } } } beforeEach(() => { @@ -26,11 +28,13 @@ describe(`PageProposal`, () => { doBefore: ({ router, store }) => { store.commit(`setConnected`, true) store.commit(`setProposal`, proposal) + store.commit(`setProposalTally`, { + proposal_id: `2`, + tally_result: tallies[`2`] + }) router.push(`/governance/proposals/${proposal.proposal_id}`) }, - propsData: { - proposalId: proposal.proposal_id - }, + propsData: { proposalId: proposal.proposal_id }, $store }) wrapper = instance.wrapper @@ -83,6 +87,7 @@ describe(`PageProposal`, () => { describe(`Proposal status`, () => { it(`displays correctly a proposal that 'Passed'`, () => { + wrapper.vm.proposal.proposal_status = `Passed` expect(wrapper.vm.status).toMatchObject({ message: `This proposal has passed` }) @@ -123,17 +128,19 @@ describe(`PageProposal`, () => { describe(`Modal onVote`, () => { it(`enables voting if the proposal is on the 'VotingPeriod'`, async () => { - let proposal = lcdClientMock.state.proposals[`2`] + let proposal = proposals[`2`] let instance = mount(PageProposal, { localVue, doBefore: ({ router, store }) => { store.commit(`setConnected`, true) router.push(`/governance/proposals/${proposal.proposal_id}`) store.commit(`setProposal`, proposal) + store.commit(`setProposalTally`, { + proposal_id: `2`, + tally_result: tallies[`2`] + }) }, - propsData: { - proposalId: proposal.proposal_id - }, + propsData: { proposalId: `2` }, $store }) wrapper = instance.wrapper @@ -145,7 +152,7 @@ describe(`PageProposal`, () => { voteBtn.trigger(`click`) expect(wrapper.vm.$store.dispatch.mock.calls).toEqual([ - [`getProposalVotes`, proposal.proposal_id] + [`getProposalVotes`, `2`] ]) expect(wrapper.vm.lastVote).not.toBeDefined() expect(wrapper.contains(ModalVote)).toEqual(true) @@ -185,7 +192,7 @@ describe(`PageProposal`, () => { describe(`Modal onDeposit`, () => { it(`enables deposits if the proposal is 'Active'`, () => { - let proposal = lcdClientMock.state.proposals[`5`] + let proposal = proposals[`5`] let instance = mount(PageProposal, { localVue, doBefore: ({ router, store }) => { @@ -203,6 +210,7 @@ describe(`PageProposal`, () => { wrapper.update() let depositBtn = wrapper.find(`#deposit-btn`) + expect(depositBtn).toBeDefined() depositBtn.trigger(`click`) expect(wrapper.contains(ModalDeposit)).toEqual(true) expect(depositBtn.html()).not.toContain(`disabled="disabled"`) @@ -217,17 +225,17 @@ describe(`PageProposal`, () => { wrapper.vm.$store.commit = jest.fn() wrapper.vm.$store.dispatch = jest.fn() - await wrapper.vm.castVote({ option: `Abstain` }) + await wrapper.vm.castVote({ option: `Abstain`, password: `12345` }) expect(wrapper.vm.$store.dispatch.mock.calls).toEqual([ - [`submitVote`, { option: `Abstain`, proposal_id: `1` }] + [`submitVote`, { option: `Abstain`, proposal_id: `2`, password: `12345` }] ]) expect(wrapper.vm.$store.commit.mock.calls).toEqual([ [ `notify`, { - body: `You have successfully voted Abstain on proposal #1`, + body: `You have successfully voted Abstain on proposal #2`, title: `Successful vote!` } ] @@ -240,10 +248,13 @@ describe(`PageProposal`, () => { throw new Error(`unexpected error`) }) - await wrapper.vm.castVote({ option: `NoWithVeto` }) + await wrapper.vm.castVote({ option: `NoWithVeto`, password: `12345` }) expect(wrapper.vm.$store.dispatch.mock.calls).toEqual([ - [`submitVote`, { option: `NoWithVeto`, proposal_id: `1` }] + [ + `submitVote`, + { option: `NoWithVeto`, proposal_id: `2`, password: `12345` } + ] ]) expect(wrapper.vm.$store.commit.mock.calls).toEqual([ @@ -251,7 +262,7 @@ describe(`PageProposal`, () => { `notifyError`, { body: `unexpected error`, - title: `Error while voting on proposal #1` + title: `Error while voting on proposal #2` } ] ]) @@ -268,14 +279,15 @@ describe(`PageProposal`, () => { } ] - await wrapper.vm.deposit({ amount }) + await wrapper.vm.deposit({ amount, password: `12345` }) expect(wrapper.vm.$store.dispatch.mock.calls).toEqual([ [ `submitDeposit`, { amount, - proposal_id: `1` + proposal_id: `2`, + password: `12345` } ] ]) @@ -284,7 +296,7 @@ describe(`PageProposal`, () => { [ `notify`, { - body: `You have successfully deposited your STAKEs on proposal #1`, + body: `You have successfully deposited your STAKEs on proposal #2`, title: `Successful deposit!` } ] @@ -304,14 +316,15 @@ describe(`PageProposal`, () => { } ] - await wrapper.vm.deposit({ amount }) + await wrapper.vm.deposit({ amount, password: `12345` }) expect(wrapper.vm.$store.dispatch.mock.calls).toEqual([ [ `submitDeposit`, { amount, - proposal_id: `1` + proposal_id: `2`, + password: `12345` } ] ]) @@ -321,7 +334,7 @@ describe(`PageProposal`, () => { `notifyError`, { body: `unexpected error`, - title: `Error while submitting a deposit on proposal #1` + title: `Error while submitting a deposit on proposal #2` } ] ]) @@ -329,17 +342,9 @@ describe(`PageProposal`, () => { it(`disables interaction buttons if not connected`, () => { store.commit(`setConnected`, false) - - store.commit( - `setProposal`, - Object.assign({}, proposal, { - proposal_status: `VotingPeriod` - }) - ) wrapper.update() - expect( - wrapper.vm.$el.querySelector(`#vote-btn`).getAttribute(`disabled`) - ).toBe(`disabled`) + let voteBtn = wrapper.find(`#vote-btn`) + expect(voteBtn.html()).toContain(`disabled="disabled"`) store.commit( `setProposal`, @@ -348,8 +353,7 @@ describe(`PageProposal`, () => { }) ) wrapper.update() - expect( - wrapper.vm.$el.querySelector(`#deposit-btn`).getAttribute(`disabled`) - ).toBe(`disabled`) + let depositBtn = wrapper.find(`#deposit-btn`) + expect(depositBtn.html()).toContain(`disabled="disabled"`) }) }) diff --git a/test/unit/specs/components/governance/TabProposals.spec.js b/test/unit/specs/components/governance/TabProposals.spec.js index 3631672aec..c43b8e02a4 100644 --- a/test/unit/specs/components/governance/TabProposals.spec.js +++ b/test/unit/specs/components/governance/TabProposals.spec.js @@ -1,10 +1,12 @@ import setup from "../../../helpers/vuex-setup" import htmlBeautify from "html-beautify" +import lcdClientMock from "renderer/connectors/lcdClientMock.js" import TabProposals from "renderer/components/governance/TabProposals" +let { tallies } = lcdClientMock.state + describe(`TabProposals`, () => { - let wrapper - let store + let wrapper, store let { mount } = setup() beforeEach(() => { @@ -20,7 +22,7 @@ describe(`TabProposals`, () => { wrapper = instance.wrapper store = instance.store - // store.state.proposals.loaded = true + store.state.proposals.tallies = tallies wrapper.update() }) @@ -49,7 +51,11 @@ describe(`TabProposals`, () => { }) it(`shows a message if there is nothing to display`, async () => { - store.state.proposals.proposals = {} + store.state.proposals = { + proposals: {}, + tallies: {}, + loaded: true + } wrapper.update() expect(htmlBeautify(wrapper.html())).toMatchSnapshot() }) diff --git a/test/unit/specs/components/governance/TableProposals.spec.js b/test/unit/specs/components/governance/TableProposals.spec.js index 85c55952e3..c925694d23 100644 --- a/test/unit/specs/components/governance/TableProposals.spec.js +++ b/test/unit/specs/components/governance/TableProposals.spec.js @@ -3,6 +3,8 @@ import htmlBeautify from "html-beautify" import TableProposals from "renderer/components/governance/TableProposals" import lcdClientMock from "renderer/connectors/lcdClientMock.js" +let { proposals } = lcdClientMock.state + describe(`TableProposals`, () => { let wrapper, store let { mount } = setup() @@ -10,7 +12,7 @@ describe(`TableProposals`, () => { beforeEach(() => { let instance = mount(TableProposals, { propsData: { - proposals: lcdClientMock.state.proposals, + proposals, loading: false } }) @@ -98,7 +100,7 @@ describe(`TableProposals`, () => { it(`should show search when there is something to search`, () => { let { wrapper, store } = mount(TableProposals, { propsData: { - proposals: lcdClientMock.state.proposals, + proposals, loading: false }, $store diff --git a/test/unit/specs/components/governance/__snapshots__/PageProposal.spec.js.snap b/test/unit/specs/components/governance/__snapshots__/PageProposal.spec.js.snap index c20b183d8b..425000a260 100644 --- a/test/unit/specs/components/governance/__snapshots__/PageProposal.spec.js.snap +++ b/test/unit/specs/components/governance/__snapshots__/PageProposal.spec.js.snap @@ -147,14 +147,14 @@ exports[`PageProposal has the expected html structure 1`] = ` class="page-profile__status-and-title" >
- Proposal Title (#1) + VotingPeriod proposal (#2)
@@ -163,13 +163,9 @@ exports[`PageProposal has the expected html structure 1`] = `
- - - - + + + +
@@ -209,7 +209,7 @@ exports[`PageProposal has the expected html structure 1`] = `
- 100 STAKE + 200 STAKE
@@ -226,7 +226,7 @@ exports[`PageProposal has the expected html structure 1`] = `
- 500 / 85% + 0 / 0%
@@ -238,7 +238,7 @@ exports[`PageProposal has the expected html structure 1`] = `
- 25 / 4% + 0 / 0%
@@ -250,10 +250,7 @@ exports[`PageProposal has the expected html structure 1`] = `
- - 10 / - 2% - + 0 / 0%
@@ -265,9 +262,7 @@ exports[`PageProposal has the expected html structure 1`] = `
- - 56 / 9% - + 0 / 0%
@@ -287,7 +282,7 @@ exports[`PageProposal has the expected html structure 1`] = ` class="text-block" >

- Proposal description + custom text proposal description

diff --git a/test/unit/specs/components/governance/__snapshots__/TabProposals.spec.js.snap b/test/unit/specs/components/governance/__snapshots__/TabProposals.spec.js.snap index b78d9e401d..ef4eda496f 100644 --- a/test/unit/specs/components/governance/__snapshots__/TabProposals.spec.js.snap +++ b/test/unit/specs/components/governance/__snapshots__/TabProposals.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`TabProposals has the expected html structure 1`] = ` -"
+"
@@ -45,10 +45,10 @@ exports[`TabProposals has the expected html structure 1`] = ` 30 @@ -70,10 +70,10 @@ exports[`TabProposals has the expected html structure 1`] = ` 0 @@ -95,10 +95,10 @@ exports[`TabProposals has the expected html structure 1`] = ` 0 @@ -120,10 +120,10 @@ exports[`TabProposals has the expected html structure 1`] = ` 25 diff --git a/test/unit/specs/store/governance/proposals.spec.js b/test/unit/specs/store/governance/proposals.spec.js index 95ab38b25e..a5a17047eb 100644 --- a/test/unit/specs/store/governance/proposals.spec.js +++ b/test/unit/specs/store/governance/proposals.spec.js @@ -76,8 +76,7 @@ describe(`Module: Proposals`, () => { value: proposal })) ), - queryProposalTally: proposal_id => - Promise.resolve(tallies[proposal_id]) + getProposalTally: proposal_id => Promise.resolve(tallies[proposal_id]) } }) From 97ca1e65ac75f5a672c2e92fe30ad0db33d44535 Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Thu, 20 Dec 2018 08:50:35 -0300 Subject: [PATCH 31/99] optimistic updates --- .../components/governance/PageProposal.vue | 19 +- .../vuex/modules/governance/proposals.js | 4 +- .../cli_home_1/keys/keys.db/000002.ldb | Bin 0 -> 478 bytes .../cli_home_1/keys/keys.db/000003.log | 0 .../testnets/cli_home_1/keys/keys.db/CURRENT | 1 + .../cli_home_1/keys/keys.db/CURRENT.bak | 1 + .../testnets/cli_home_1/keys/keys.db/LOCK | 0 .../testnets/cli_home_1/keys/keys.db/LOG | 16 ++ .../cli_home_1/keys/keys.db/MANIFEST-000004 | Bin 0 -> 219 bytes .../testnets/node_home_1/config/config.toml | 249 ++++++++++++++++++ .../testnets/node_home_1/config/gaiad.toml | 7 + .../node_home_1/config/gaiaversion.txt | 1 + .../testnets/node_home_1/config/genesis.json | 180 +++++++++++++ ...e705b48a49837530d0b3f5bcbb5f6d29b12cd.json | 41 +++ .../testnets/node_home_1/config/node_key.json | 6 + .../node_home_1/config/priv_validator.json | 14 + 16 files changed, 522 insertions(+), 17 deletions(-) create mode 100644 tasks/builds/testnets/cli_home_1/keys/keys.db/000002.ldb create mode 100644 tasks/builds/testnets/cli_home_1/keys/keys.db/000003.log create mode 100644 tasks/builds/testnets/cli_home_1/keys/keys.db/CURRENT create mode 100644 tasks/builds/testnets/cli_home_1/keys/keys.db/CURRENT.bak create mode 100644 tasks/builds/testnets/cli_home_1/keys/keys.db/LOCK create mode 100644 tasks/builds/testnets/cli_home_1/keys/keys.db/LOG create mode 100644 tasks/builds/testnets/cli_home_1/keys/keys.db/MANIFEST-000004 create mode 100644 tasks/builds/testnets/node_home_1/config/config.toml create mode 100644 tasks/builds/testnets/node_home_1/config/gaiad.toml create mode 100644 tasks/builds/testnets/node_home_1/config/gaiaversion.txt create mode 100644 tasks/builds/testnets/node_home_1/config/genesis.json create mode 100644 tasks/builds/testnets/node_home_1/config/gentx/gentx-6c7e705b48a49837530d0b3f5bcbb5f6d29b12cd.json create mode 100644 tasks/builds/testnets/node_home_1/config/node_key.json create mode 100644 tasks/builds/testnets/node_home_1/config/priv_validator.json diff --git a/app/src/renderer/components/governance/PageProposal.vue b/app/src/renderer/components/governance/PageProposal.vue index 3b25e72d52..15c361f4c1 100644 --- a/app/src/renderer/components/governance/PageProposal.vue +++ b/app/src/renderer/components/governance/PageProposal.vue @@ -151,7 +151,6 @@ export default { } }, data: () => ({ - proposal: undefined, showModalDeposit: false, showModalVote: false, lastVote: undefined @@ -165,6 +164,9 @@ export default { `wallet`, `votes` ]), + proposal() { + return this.proposals.proposals[this.proposalId] + }, proposalType() { return this.proposal.proposal_type.toLowerCase() }, @@ -198,12 +200,7 @@ export default { return num.percentInt(this.tally.abstain / this.totalVotes) }, tally() { - let proposalTally - if (this.proposal.proposal_status === `VotingPeriod`) { - proposalTally = this.proposals.tallies[this.proposalId] - } else { - proposalTally = this.proposal.tally_result - } + let proposalTally = this.proposals.tallies[this.proposalId] proposalTally.yes = Math.round(parseFloat(proposalTally.yes)) proposalTally.no = Math.round(parseFloat(proposalTally.no)) proposalTally.no_with_veto = Math.round( @@ -239,12 +236,6 @@ export default { } } }, - mounted() { - this.proposal = this.proposals.proposals[this.proposalId] - }, - updated() { - this.proposal = this.proposals.proposals[this.proposalId] - }, methods: { async onVote() { this.showModalVote = true @@ -291,13 +282,13 @@ export default { password }) - this.proposal = this.proposals.proposals[this.proposalId] this.$store.commit(`notify`, { title: `Successful vote!`, body: `You have successfully voted ${option} on proposal #${ this.proposalId }` }) + this.proposal = this.proposals.proposals[this.proposalId] } catch ({ message }) { this.$store.commit(`notifyError`, { title: `Error while voting on proposal #${this.proposalId}`, diff --git a/app/src/renderer/vuex/modules/governance/proposals.js b/app/src/renderer/vuex/modules/governance/proposals.js index a2da64f449..9eb5c741fa 100644 --- a/app/src/renderer/vuex/modules/governance/proposals.js +++ b/app/src/renderer/vuex/modules/governance/proposals.js @@ -77,9 +77,7 @@ export default ({ node }) => { let proposal = await node.queryProposal(proposal_id) commit(`setProposal`, proposal.value) if (proposal.value.proposal_status === `VotingPeriod`) { - tally_result = await node.queryProposalTally( - proposal.value.proposal_id - ) + tally_result = await node.getProposalTally(proposal.value.proposal_id) } else { tally_result = JSON.parse(JSON.stringify(proposal.value.tally_result)) } diff --git a/tasks/builds/testnets/cli_home_1/keys/keys.db/000002.ldb b/tasks/builds/testnets/cli_home_1/keys/keys.db/000002.ldb new file mode 100644 index 0000000000000000000000000000000000000000..6bf378e6c109fb76ad9adf199fcc24aaff976a7a GIT binary patch literal 478 zcmbQi{2`ISmNz-SI5)r8uprkWyS%d0Bss&_JTcMSqM)Fn+^9U=#G)iI*QC6%C^w}r zqdY|~F(suawYZp(i2)2si&Km85_41aGV{{%8AMkxp$ITCGB7ZzE39DRT`OwK#Zk(u z_rXUM;EienJaE|mTHwa30&dc>F zDU5J6@(tFHaLn+^b;>mft*D4H%P?E;lds3--!LE_X8y&&;WEPs=TEH!(=gD0Fr&w&k)dD-A8ON9S! K=vFCpzYPEuYl%nz literal 0 HcmV?d00001 diff --git a/tasks/builds/testnets/cli_home_1/keys/keys.db/000003.log b/tasks/builds/testnets/cli_home_1/keys/keys.db/000003.log new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tasks/builds/testnets/cli_home_1/keys/keys.db/CURRENT b/tasks/builds/testnets/cli_home_1/keys/keys.db/CURRENT new file mode 100644 index 0000000000..cacca7574c --- /dev/null +++ b/tasks/builds/testnets/cli_home_1/keys/keys.db/CURRENT @@ -0,0 +1 @@ +MANIFEST-000004 diff --git a/tasks/builds/testnets/cli_home_1/keys/keys.db/CURRENT.bak b/tasks/builds/testnets/cli_home_1/keys/keys.db/CURRENT.bak new file mode 100644 index 0000000000..feda7d6b24 --- /dev/null +++ b/tasks/builds/testnets/cli_home_1/keys/keys.db/CURRENT.bak @@ -0,0 +1 @@ +MANIFEST-000000 diff --git a/tasks/builds/testnets/cli_home_1/keys/keys.db/LOCK b/tasks/builds/testnets/cli_home_1/keys/keys.db/LOCK new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tasks/builds/testnets/cli_home_1/keys/keys.db/LOG b/tasks/builds/testnets/cli_home_1/keys/keys.db/LOG new file mode 100644 index 0000000000..cd02b2d8c1 --- /dev/null +++ b/tasks/builds/testnets/cli_home_1/keys/keys.db/LOG @@ -0,0 +1,16 @@ +=============== Dec 20, 2018 (-03) =============== +08:33:56.762506 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed +08:33:56.763930 db@open opening +08:33:56.764846 version@stat F·[] S·0B[] Sc·[] +08:33:56.765241 db@janitor F·2 G·0 +08:33:56.765283 db@open done T·1.311232ms +=============== Dec 20, 2018 (-03) =============== +08:33:57.099335 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed +08:33:57.099588 version@stat F·[] S·0B[] Sc·[] +08:33:57.099612 db@open opening +08:33:57.099688 journal@recovery F·1 +08:33:57.099809 journal@recovery recovering @1 +08:33:57.100348 memdb@flush created L0@2 N·2 S·478B "cos..ess,v2":"use..nfo,v1" +08:33:57.100732 version@stat F·[1] S·478B[478B] Sc·[0.25] +08:33:57.102119 db@janitor F·3 G·0 +08:33:57.102152 db@open done T·2.526703ms diff --git a/tasks/builds/testnets/cli_home_1/keys/keys.db/MANIFEST-000004 b/tasks/builds/testnets/cli_home_1/keys/keys.db/MANIFEST-000004 new file mode 100644 index 0000000000000000000000000000000000000000..4357006405a264ce8a46f6f461fbd6eabc5464f0 GIT binary patch literal 219 zcmZRJ_;%t710$nUPHI_dPD+xVQ)NkNd1i5{bAE0?Vo_pAei0KhGb;--I|I`_X4~Za z;@tdV!-8Ck?DEP|ljICz^Tb4Ri-LlRa-;He6N{3>T$A$3qTH0ijPew{#FUhx)Z$`B cCI&DNEiFzh%1g{m)yvFF%V%VSh| Date: Thu, 20 Dec 2018 08:53:42 -0300 Subject: [PATCH 32/99] Delete config.toml --- .../testnets/node_home_1/config/config.toml | 249 ------------------ 1 file changed, 249 deletions(-) delete mode 100644 tasks/builds/testnets/node_home_1/config/config.toml diff --git a/tasks/builds/testnets/node_home_1/config/config.toml b/tasks/builds/testnets/node_home_1/config/config.toml deleted file mode 100644 index 3b2de5b72d..0000000000 --- a/tasks/builds/testnets/node_home_1/config/config.toml +++ /dev/null @@ -1,249 +0,0 @@ -# This is a TOML config file. -# For more information, see https://github.com/toml-lang/toml - -##### main base config options ##### - -# TCP or UNIX socket address of the ABCI application, -# or the name of an ABCI application compiled in with the Tendermint binary -proxy_app = "tcp://127.0.0.1:26658" - -# A custom human readable name for this node -moniker = "local_1" - -# If this node is many blocks behind the tip of the chain, FastSync -# allows them to catchup quickly by downloading blocks in parallel -# and verifying their commits -fast_sync = true - -# Database backend: leveldb | memdb | cleveldb -db_backend = "leveldb" - -# Database directory -db_dir = "data" - -# Output level for logging, including package level options -log_level = "main:info,state:info,*:error" - -# Output format: 'plain' (colored text) or 'json' -log_format = "plain" - -##### additional base config options ##### - -# Path to the JSON file containing the initial validator set and other meta data -genesis_file = "config/genesis.json" - -# Path to the JSON file containing the private key to use as a validator in the consensus protocol -priv_validator_file = "config/priv_validator.json" - -# TCP or UNIX socket address for Tendermint to listen on for -# connections from an external PrivValidator process -priv_validator_laddr = "" - -# Path to the JSON file containing the private key to use for node authentication in the p2p protocol -node_key_file = "config/node_key.json" - -# Mechanism to connect to the ABCI application: socket | grpc -abci = "socket" - -# TCP or UNIX socket address for the profiling server to listen on -prof_laddr = "localhost:6060" - -# If true, query the ABCI app on connecting to a new peer -# so the app can decide if we should keep the connection or not -filter_peers = false - -##### advanced configuration options ##### - -##### rpc server configuration options ##### -[rpc] - -# TCP or UNIX socket address for the RPC server to listen on -laddr = "tcp://0.0.0.0:26657" - -# A list of origins a cross-domain request can be executed from -# Default value '[]' disables cors support -# Use '["*"]' to allow any origin -cors_allowed_origins = "[[]]" - -# A list of methods the client is allowed to use with cross-domain requests -cors_allowed_methods = "[[HEAD GET POST] GET POST]" - -# A list of non simple headers the client is allowed to use with cross-domain requests -cors_allowed_headers = "[[Origin Accept Content-Type X-Requested-With X-Server-Time] Accept Content-Type X-Requested-With X-Server-Time]" - -# TCP or UNIX socket address for the gRPC server to listen on -# NOTE: This server only supports /broadcast_tx_commit -grpc_laddr = "" - -# Maximum number of simultaneous connections. -# Does not include RPC (HTTP&WebSocket) connections. See max_open_connections -# If you want to accept more significant number than the default, make sure -# you increase your OS limits. -# 0 - unlimited. -# Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files} -# 1024 - 40 - 10 - 50 = 924 = ~900 -grpc_max_open_connections = 900 - -# Activate unsafe RPC commands like /dial_seeds and /unsafe_flush_mempool -unsafe = false - -# Maximum number of simultaneous connections (including WebSocket). -# Does not include gRPC connections. See grpc_max_open_connections -# If you want to accept more significant number than the default, make sure -# you increase your OS limits. -# 0 - unlimited. -# Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files} -# 1024 - 40 - 10 - 50 = 924 = ~900 -max_open_connections = 900 - -##### peer to peer configuration options ##### -[p2p] - -# Address to listen for incoming connections -laddr = "tcp://0.0.0.0:26656" - -# Address to advertise to peers for them to dial -# If empty, will use the same port as the laddr, -# and will introspect on the listener or use UPnP -# to figure out the address. -external_address = "" - -# Comma separated list of seed nodes to connect to -seeds = "" - -# Comma separated list of nodes to keep persistent connections to -persistent_peers = "" - -# UPNP port forwarding -upnp = false - -# Path to address book -addr_book_file = "config/addrbook.json" - -# Set true for strict address routability rules -# Set false for private or local networks -addr_book_strict = true - -# Maximum number of inbound peers -max_num_inbound_peers = 40 - -# Maximum number of outbound peers to connect to, excluding persistent peers -max_num_outbound_peers = 10 - -# Time to wait before flushing messages out on the connection -flush_throttle_timeout = "100ms" - -# Maximum size of a message packet payload, in bytes -max_packet_msg_payload_size = 1024 - -# Rate at which packets can be sent, in bytes/second -send_rate = 5120000 - -# Rate at which packets can be received, in bytes/second -recv_rate = 5120000 - -# Set true to enable the peer-exchange reactor -pex = true - -# Seed mode, in which node constantly crawls the network and looks for -# peers. If another node asks it for addresses, it responds and disconnects. -# -# Does not work if the peer-exchange reactor is disabled. -seed_mode = false - -# Comma separated list of peer IDs to keep private (will not be gossiped to other peers) -private_peer_ids = "" - -# Toggle to disable guard against peers connecting from the same ip. -allow_duplicate_ip = true - -# Peer connection configuration. -handshake_timeout = "20s" -dial_timeout = "3s" - -##### mempool configuration options ##### -[mempool] - -recheck = true -broadcast = true -wal_dir = "" - -# size of the mempool -size = 5000 - -# size of the cache (used to filter transactions we saw earlier) -cache_size = 10000 - -##### consensus configuration options ##### -[consensus] - -wal_file = "data/cs.wal/wal" - -timeout_propose = "3s" -timeout_propose_delta = "500ms" -timeout_prevote = "1s" -timeout_prevote_delta = "500ms" -timeout_precommit = "1s" -timeout_precommit_delta = "500ms" -timeout_commit = "5s" - -# Make progress as soon as we have all the precommits (as if TimeoutCommit = 0) -skip_timeout_commit = false - -# EmptyBlocks mode and possible interval between empty blocks -create_empty_blocks = true -create_empty_blocks_interval = "0s" - -# Reactor sleep duration parameters -peer_gossip_sleep_duration = "100ms" -peer_query_maj23_sleep_duration = "2s" - -# Block time parameters. Corresponds to the minimum time increment between consecutive blocks. -blocktime_iota = "1s" - -##### transactions indexer configuration options ##### -[tx_index] - -# What indexer to use for transactions -# -# Options: -# 1) "null" (default) -# 2) "kv" - the simplest possible indexer, backed by key-value storage (defaults to levelDB; see DBBackend). -indexer = "kv" - -# Comma-separated list of tags to index (by default the only tag is "tx.hash") -# -# You can also index transactions by height by adding "tx.height" tag here. -# -# It's recommended to index only a subset of tags due to possible memory -# bloat. This is, of course, depends on the indexer's DB and the volume of -# transactions. -index_tags = "" - -# When set to true, tells indexer to index all tags (predefined tags: -# "tx.hash", "tx.height" and all tags from DeliverTx responses). -# -# Note this may be not desirable (see the comment above). IndexTags has a -# precedence over IndexAllTags (i.e. when given both, IndexTags will be -# indexed). -index_all_tags = true - -##### instrumentation configuration options ##### -[instrumentation] - -# When true, Prometheus metrics are served under /metrics on -# PrometheusListenAddr. -# Check out the documentation for the list of available metrics. -prometheus = false - -# Address to listen for Prometheus collector(s) connections -prometheus_listen_addr = ":26660" - -# Maximum number of simultaneous connections. -# If you want to accept more significant number than the default, make sure -# you increase your OS limits. -# 0 - unlimited. -max_open_connections = 3 - -# Instrumentation namespace -namespace = "tendermint" From ef9f21e5a90b49f9f7896fe9494b8ee914bf655b Mon Sep 17 00:00:00 2001 From: Federico Kunze <31522760+fedekunze@users.noreply.github.com> Date: Thu, 20 Dec 2018 08:53:59 -0300 Subject: [PATCH 33/99] Delete genesis.json --- .../testnets/node_home_1/config/genesis.json | 180 ------------------ 1 file changed, 180 deletions(-) delete mode 100644 tasks/builds/testnets/node_home_1/config/genesis.json diff --git a/tasks/builds/testnets/node_home_1/config/genesis.json b/tasks/builds/testnets/node_home_1/config/genesis.json deleted file mode 100644 index d85366636d..0000000000 --- a/tasks/builds/testnets/node_home_1/config/genesis.json +++ /dev/null @@ -1,180 +0,0 @@ -{ - "genesis_time": "2018-12-20T11:33:57.4235Z", - "chain_id": "default-testnet", - "consensus_params": { - "block_size": { - "max_bytes": "22020096", - "max_gas": "-1" - }, - "evidence": { - "max_age": "100000" - }, - "validator": { - "pub_key_types": ["ed25519"] - } - }, - "app_hash": "", - "app_state": { - "accounts": [ - { - "address": "cosmos1pm8kwyu4ch37aa78ppxw2wg48tam4wyrmdqhwd", - "coins": [ - { - "denom": "STAKE", - "amount": "150" - }, - { - "denom": "localcoin", - "amount": "1000" - } - ], - "sequence_number": "0", - "account_number": "0" - } - ], - "auth": { - "collected_fees": null - }, - "stake": { - "pool": { - "loose_tokens": "150.0000000000", - "bonded_tokens": "0.0000000000" - }, - "params": { - "unbonding_time": "259200000000000", - "max_validators": 100, - "bond_denom": "STAKE" - }, - "last_total_power": "0", - "last_validator_powers": null, - "validators": null, - "bonds": null, - "unbonding_delegations": null, - "redelegations": null, - "exported": false - }, - "mint": { - "minter": { - "inflation": "0.1300000000", - "annual_provisions": "0.0000000000" - }, - "params": { - "mint_denom": "STAKE", - "inflation_rate_change": "0.1300000000", - "inflation_max": "0.2000000000", - "inflation_min": "0.0700000000", - "goal_bonded": "0.6700000000", - "blocks_per_year": "6311520" - } - }, - "distr": { - "fee_pool": { - "val_accum": { - "update_height": "0", - "accum": "0.0000000000" - }, - "val_pool": null, - "community_pool": null - }, - "community_tax": "0.0200000000", - "base_proposer_reward": "0.0100000000", - "bonus_proposer_reward": "0.0400000000", - "validator_dist_infos": null, - "delegator_dist_infos": null, - "delegator_withdraw_infos": null, - "previous_proposer": "cosmosvalcons1m46yrx" - }, - "gov": { - "starting_proposal_id": "1", - "deposits": null, - "votes": null, - "proposals": null, - "deposit_params": { - "min_deposit": [ - { - "denom": "STAKE", - "amount": "10" - } - ], - "max_deposit_period": "172800000000000" - }, - "voting_params": { - "voting_period": "172800000000000" - }, - "tally_params": { - "quorum": "0.3340000000", - "threshold": "0.5000000000", - "veto": "0.3340000000", - "governance_penalty": "0.0100000000" - } - }, - "slashing": { - "params": { - "max-evidence-age": "120000000000", - "signed-blocks-window": "100", - "min-signed-per-window": "0.5000000000", - "double-sign-unbond-duration": "300000000000", - "downtime-unbond-duration": "600000000000", - "slash-fraction-double-sign": "0.0500000000", - "slash-fraction-downtime": "0.0100000000" - }, - "signing_infos": {}, - "missed_blocks": {}, - "slashing_periods": null - }, - "gentxs": [ - { - "type": "auth/StdTx", - "value": { - "msg": [ - { - "type": "cosmos-sdk/MsgCreateValidator", - "value": { - "Description": { - "moniker": "local_1", - "identity": "", - "website": "", - "details": "" - }, - "Commission": { - "rate": "0.1000000000", - "max_rate": "0.2000000000", - "max_change_rate": "0.0100000000" - }, - "delegator_address": "cosmos1pm8kwyu4ch37aa78ppxw2wg48tam4wyrmdqhwd", - "validator_address": "cosmosvaloper1pm8kwyu4ch37aa78ppxw2wg48tam4wyr7e5zz7", - "pubkey": { - "type": "tendermint/PubKeyEd25519", - "value": "0q9vEcnglZI5aDK3nXcW6GyRKi/CB6BPBF1LzKFlSlE=" - }, - "delegation": { - "denom": "STAKE", - "amount": "100" - } - } - } - ], - "fee": { - "amount": [ - { - "denom": "", - "amount": "0" - } - ], - "gas": "200000" - }, - "signatures": [ - { - "pub_key": { - "type": "tendermint/PubKeySecp256k1", - "value": "A+ogj5sLoL20iJF86XojqeJs3jY2fNrObEzPhXsAdwNQ" - }, - "signature": "T0cg5ChsjeE46CegWr68tgtvc5A0mNW/84VoFH1KSG1zKrCuClY3sDGEQgtClAdnHVi7TiqdmKQNxnuAimmMdw==" - } - ], - "memo": "6c7e705b48a49837530d0b3f5bcbb5f6d29b12cd@192.168.0.188:26656" - } - } - ] - } -} From 56a5ce9b5c4c6b98d58d81b63a50eff295df94ba Mon Sep 17 00:00:00 2001 From: Federico Kunze <31522760+fedekunze@users.noreply.github.com> Date: Thu, 20 Dec 2018 08:54:25 -0300 Subject: [PATCH 34/99] Delete priv_validator.json --- .../node_home_1/config/priv_validator.json | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 tasks/builds/testnets/node_home_1/config/priv_validator.json diff --git a/tasks/builds/testnets/node_home_1/config/priv_validator.json b/tasks/builds/testnets/node_home_1/config/priv_validator.json deleted file mode 100644 index 9cf86c04ae..0000000000 --- a/tasks/builds/testnets/node_home_1/config/priv_validator.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "address": "88A48D81F04D68266D83250242E2355DA248662E", - "pub_key": { - "type": "tendermint/PubKeyEd25519", - "value": "0q9vEcnglZI5aDK3nXcW6GyRKi/CB6BPBF1LzKFlSlE=" - }, - "last_height": "0", - "last_round": "0", - "last_step": 0, - "priv_key": { - "type": "tendermint/PrivKeyEd25519", - "value": "bJaIjJ1HX7UTTOMOOAYDlxvpSWF2vlU6Ms84+MwLWNzSr28RyeCVkjloMreddxbobJEqL8IHoE8EXUvMoWVKUQ==" - } -} From 5008bbe7bedd70c16f9ae2598af072373e7b6fc0 Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Thu, 20 Dec 2018 08:55:56 -0300 Subject: [PATCH 35/99] delete task/builds --- .gitignore | 1 + .../cli_home_1/keys/keys.db/000002.ldb | Bin 478 -> 0 bytes .../cli_home_1/keys/keys.db/000003.log | 0 .../testnets/cli_home_1/keys/keys.db/CURRENT | 1 - .../cli_home_1/keys/keys.db/CURRENT.bak | 1 - .../testnets/cli_home_1/keys/keys.db/LOCK | 0 .../testnets/cli_home_1/keys/keys.db/LOG | 16 -- .../cli_home_1/keys/keys.db/MANIFEST-000004 | Bin 219 -> 0 bytes .../testnets/node_home_1/config/config.toml | 249 ------------------ .../testnets/node_home_1/config/gaiad.toml | 7 - .../node_home_1/config/gaiaversion.txt | 1 - .../testnets/node_home_1/config/genesis.json | 180 ------------- ...e705b48a49837530d0b3f5bcbb5f6d29b12cd.json | 41 --- .../testnets/node_home_1/config/node_key.json | 6 - .../node_home_1/config/priv_validator.json | 14 - 15 files changed, 1 insertion(+), 516 deletions(-) delete mode 100644 tasks/builds/testnets/cli_home_1/keys/keys.db/000002.ldb delete mode 100644 tasks/builds/testnets/cli_home_1/keys/keys.db/000003.log delete mode 100644 tasks/builds/testnets/cli_home_1/keys/keys.db/CURRENT delete mode 100644 tasks/builds/testnets/cli_home_1/keys/keys.db/CURRENT.bak delete mode 100644 tasks/builds/testnets/cli_home_1/keys/keys.db/LOCK delete mode 100644 tasks/builds/testnets/cli_home_1/keys/keys.db/LOG delete mode 100644 tasks/builds/testnets/cli_home_1/keys/keys.db/MANIFEST-000004 delete mode 100644 tasks/builds/testnets/node_home_1/config/config.toml delete mode 100644 tasks/builds/testnets/node_home_1/config/gaiad.toml delete mode 100644 tasks/builds/testnets/node_home_1/config/gaiaversion.txt delete mode 100644 tasks/builds/testnets/node_home_1/config/genesis.json delete mode 100644 tasks/builds/testnets/node_home_1/config/gentx/gentx-6c7e705b48a49837530d0b3f5bcbb5f6d29b12cd.json delete mode 100644 tasks/builds/testnets/node_home_1/config/node_key.json delete mode 100644 tasks/builds/testnets/node_home_1/config/priv_validator.json diff --git a/.gitignore b/.gitignore index 158ae644d2..e4aeebbbc7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .DS_Store app/dist builds/* +task/builds/* coverage node_modules npm-debug.log diff --git a/tasks/builds/testnets/cli_home_1/keys/keys.db/000002.ldb b/tasks/builds/testnets/cli_home_1/keys/keys.db/000002.ldb deleted file mode 100644 index 6bf378e6c109fb76ad9adf199fcc24aaff976a7a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 478 zcmbQi{2`ISmNz-SI5)r8uprkWyS%d0Bss&_JTcMSqM)Fn+^9U=#G)iI*QC6%C^w}r zqdY|~F(suawYZp(i2)2si&Km85_41aGV{{%8AMkxp$ITCGB7ZzE39DRT`OwK#Zk(u z_rXUM;EienJaE|mTHwa30&dc>F zDU5J6@(tFHaLn+^b;>mft*D4H%P?E;lds3--!LE_X8y&&;WEPs=TEH!(=gD0Fr&w&k)dD-A8ON9S! K=vFCpzYPEuYl%nz diff --git a/tasks/builds/testnets/cli_home_1/keys/keys.db/000003.log b/tasks/builds/testnets/cli_home_1/keys/keys.db/000003.log deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tasks/builds/testnets/cli_home_1/keys/keys.db/CURRENT b/tasks/builds/testnets/cli_home_1/keys/keys.db/CURRENT deleted file mode 100644 index cacca7574c..0000000000 --- a/tasks/builds/testnets/cli_home_1/keys/keys.db/CURRENT +++ /dev/null @@ -1 +0,0 @@ -MANIFEST-000004 diff --git a/tasks/builds/testnets/cli_home_1/keys/keys.db/CURRENT.bak b/tasks/builds/testnets/cli_home_1/keys/keys.db/CURRENT.bak deleted file mode 100644 index feda7d6b24..0000000000 --- a/tasks/builds/testnets/cli_home_1/keys/keys.db/CURRENT.bak +++ /dev/null @@ -1 +0,0 @@ -MANIFEST-000000 diff --git a/tasks/builds/testnets/cli_home_1/keys/keys.db/LOCK b/tasks/builds/testnets/cli_home_1/keys/keys.db/LOCK deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tasks/builds/testnets/cli_home_1/keys/keys.db/LOG b/tasks/builds/testnets/cli_home_1/keys/keys.db/LOG deleted file mode 100644 index cd02b2d8c1..0000000000 --- a/tasks/builds/testnets/cli_home_1/keys/keys.db/LOG +++ /dev/null @@ -1,16 +0,0 @@ -=============== Dec 20, 2018 (-03) =============== -08:33:56.762506 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed -08:33:56.763930 db@open opening -08:33:56.764846 version@stat F·[] S·0B[] Sc·[] -08:33:56.765241 db@janitor F·2 G·0 -08:33:56.765283 db@open done T·1.311232ms -=============== Dec 20, 2018 (-03) =============== -08:33:57.099335 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed -08:33:57.099588 version@stat F·[] S·0B[] Sc·[] -08:33:57.099612 db@open opening -08:33:57.099688 journal@recovery F·1 -08:33:57.099809 journal@recovery recovering @1 -08:33:57.100348 memdb@flush created L0@2 N·2 S·478B "cos..ess,v2":"use..nfo,v1" -08:33:57.100732 version@stat F·[1] S·478B[478B] Sc·[0.25] -08:33:57.102119 db@janitor F·3 G·0 -08:33:57.102152 db@open done T·2.526703ms diff --git a/tasks/builds/testnets/cli_home_1/keys/keys.db/MANIFEST-000004 b/tasks/builds/testnets/cli_home_1/keys/keys.db/MANIFEST-000004 deleted file mode 100644 index 4357006405a264ce8a46f6f461fbd6eabc5464f0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 219 zcmZRJ_;%t710$nUPHI_dPD+xVQ)NkNd1i5{bAE0?Vo_pAei0KhGb;--I|I`_X4~Za z;@tdV!-8Ck?DEP|ljICz^Tb4Ri-LlRa-;He6N{3>T$A$3qTH0ijPew{#FUhx)Z$`B cCI&DNEiFzh%1g{m)yvFF%V%VSh| Date: Thu, 20 Dec 2018 10:02:26 -0300 Subject: [PATCH 36/99] fixed tests --- .../components/governance/TableProposals.vue | 14 +--- .../components/governance/LiProposal.spec.js | 44 +++++------- .../governance/PageProposal.spec.js | 18 +++-- .../governance/TableProposals.spec.js | 67 +++++++------------ .../__snapshots__/LiProposal.spec.js.snap | 26 +++---- .../__snapshots__/TableProposals.spec.js.snap | 24 +++---- test/unit/specs/lcdClient.spec.js | 2 +- 7 files changed, 79 insertions(+), 116 deletions(-) diff --git a/app/src/renderer/components/governance/TableProposals.vue b/app/src/renderer/components/governance/TableProposals.vue index a98ade5be6..d0b1786857 100644 --- a/app/src/renderer/components/governance/TableProposals.vue +++ b/app/src/renderer/components/governance/TableProposals.vue @@ -52,22 +52,10 @@ export default { somethingToSearch() { return Object.keys(this.proposals).length > 0 }, - parsedProposals() { - let copiedProposals = JSON.parse(JSON.stringify(this.proposals)) - return Object.values(copiedProposals).map(p => { - p.tally_result.yes = Math.round(parseFloat(p.tally_result.yes)) - p.tally_result.no = Math.round(parseFloat(p.tally_result.no)) - p.tally_result.no_with_veto = Math.round( - parseFloat(p.tally_result.no_with_veto) - ) - p.tally_result.abstain = Math.round(parseFloat(p.tally_result.abstain)) - return p - }) - }, filteredProposals() { let query = this.filters.proposals.search.query || `` let proposals = orderBy( - this.parsedProposals, + this.proposals, [this.sort.property], [this.sort.order] ) diff --git a/test/unit/specs/components/governance/LiProposal.spec.js b/test/unit/specs/components/governance/LiProposal.spec.js index 5f6bbcf673..b6c51f0244 100644 --- a/test/unit/specs/components/governance/LiProposal.spec.js +++ b/test/unit/specs/components/governance/LiProposal.spec.js @@ -3,9 +3,11 @@ import lcdClientMock from "renderer/connectors/lcdClientMock.js" import LiProposal from "renderer/components/governance/LiProposal" let { proposals, tallies } = lcdClientMock.state -let proposal = proposals[`1`] +let proposal = proposals[`2`] const $store = { + commit: jest.fn(), + dispatch: jest.fn(), getters: { proposals: { proposals, tallies } } @@ -17,6 +19,14 @@ describe(`LiProposal`, () => { beforeEach(() => { let instance = mount(LiProposal, { + doBefore: ({ store }) => { + store.commit(`setConnected`, true) + store.commit(`setProposal`, proposal) + store.commit(`setProposalTally`, { + proposal_id: `2`, + tally_result: tallies[`2`] + }) + }, propsData: { proposal }, $store }) @@ -30,10 +40,7 @@ describe(`LiProposal`, () => { it(`should return status info for passed proposals`, () => { proposal.proposal_status = `Passed` - let { wrapper } = mount(LiProposal, { - propsData: { proposal }, - $store - }) + wrapper.setProps({ proposal }) wrapper.update() expect(wrapper.vm.status).toEqual({ message: `This proposal has passed` @@ -42,10 +49,7 @@ describe(`LiProposal`, () => { it(`should return status info for rejected proposals`, () => { proposal.proposal_status = `Rejected` - let { wrapper } = mount(LiProposal, { - propsData: { proposal }, - $store - }) + wrapper.setProps({ proposal }) wrapper.update() expect(wrapper.vm.status).toEqual({ message: `This proposal has been rejected and voting is closed`, @@ -55,10 +59,7 @@ describe(`LiProposal`, () => { it(`should return status info for active proposals`, () => { proposal.proposal_status = `VotingPeriod` - let { wrapper } = mount(LiProposal, { - propsData: { proposal }, - $store - }) + wrapper.setProps({ proposal }) wrapper.update() expect(wrapper.vm.status).toEqual({ message: `Voting for this proposal is open`, @@ -68,10 +69,7 @@ describe(`LiProposal`, () => { it(`should return status info for 'DepositPeriod' proposals`, () => { proposal.proposal_status = `DepositPeriod` - let { wrapper } = mount(LiProposal, { - propsData: { proposal }, - $store - }) + wrapper.setProps({ proposal }) wrapper.update() expect(wrapper.vm.status).toEqual({ message: `Deposits are open for this proposal`, @@ -81,10 +79,7 @@ describe(`LiProposal`, () => { it(`should return status info for an unknown proposal type`, () => { proposal.proposal_status = `Unknown` - let { wrapper } = mount(LiProposal, { - propsData: { proposal }, - $store - }) + wrapper.setProps({ proposal }) wrapper.update() expect(wrapper.vm.status).toEqual({ message: `There was an error determining the status of this proposal.`, @@ -93,15 +88,12 @@ describe(`LiProposal`, () => { }) it(`should not truncate the description or add an ellipsis`, () => { - expect(wrapper.vm.description).toEqual(`Proposal description`) + expect(wrapper.vm.description).toEqual(`custom text proposal description`) }) it(`should truncate the description and add an ellipsis`, () => { proposal.description = `this is some kind of long description. longer than 100 characters for optimum-maximum-ideal truncation.` - let { wrapper } = mount(LiProposal, { - propsData: { proposal }, - $store - }) + wrapper.setProps({ proposal }) wrapper.update() expect(wrapper.vm.description).toEqual( `this is some kind of long description. longer than 100 characters for optimum-maximum-ideal truncati…` diff --git a/test/unit/specs/components/governance/PageProposal.spec.js b/test/unit/specs/components/governance/PageProposal.spec.js index 03d928ad6a..2267cc8b66 100644 --- a/test/unit/specs/components/governance/PageProposal.spec.js +++ b/test/unit/specs/components/governance/PageProposal.spec.js @@ -127,8 +127,10 @@ describe(`PageProposal`, () => { }) describe(`Modal onVote`, () => { - it(`enables voting if the proposal is on the 'VotingPeriod'`, async () => { + it(`enables voting if the proposal is on the 'VotingPeriod'`, () => { let proposal = proposals[`2`] + proposal.proposal_status = `VotingPeriod` + console.log(proposal.proposal_status) let instance = mount(PageProposal, { localVue, doBefore: ({ router, store }) => { @@ -140,14 +142,15 @@ describe(`PageProposal`, () => { tally_result: tallies[`2`] }) }, - propsData: { proposalId: `2` }, + propsData: { + proposalId: proposal.proposal_id + }, $store }) wrapper = instance.wrapper store = instance.store wrapper.update() - wrapper.vm.$store.dispatch = jest.fn() let voteBtn = wrapper.find(`#vote-btn`) voteBtn.trigger(`click`) @@ -186,12 +189,13 @@ describe(`PageProposal`, () => { }) it(`disables voting if the proposal is on the 'DepositPeriod'`, () => { + wrapper.setProps({ proposalId: `5` }) expect(wrapper.find(`#vote-btn`).exists()).toEqual(false) }) }) describe(`Modal onDeposit`, () => { - it(`enables deposits if the proposal is 'Active'`, () => { + it(`enables deposits if the proposal on 'DepositPeriod'`, () => { let proposal = proposals[`5`] let instance = mount(PageProposal, { localVue, @@ -199,6 +203,10 @@ describe(`PageProposal`, () => { store.commit(`setConnected`, true) router.push(`/governance/proposals/${proposal.proposal_id}`) store.commit(`setProposal`, proposal) + store.commit(`setProposalTally`, { + proposal_id: `5`, + tally_result: tallies[`5`] + }) }, propsData: { proposalId: proposal.proposal_id @@ -207,10 +215,10 @@ describe(`PageProposal`, () => { }) wrapper = instance.wrapper store = instance.store + wrapper.vm.proposal.proposal_status = `DepositPeriod` wrapper.update() let depositBtn = wrapper.find(`#deposit-btn`) - expect(depositBtn).toBeDefined() depositBtn.trigger(`click`) expect(wrapper.contains(ModalDeposit)).toEqual(true) expect(depositBtn.html()).not.toContain(`disabled="disabled"`) diff --git a/test/unit/specs/components/governance/TableProposals.spec.js b/test/unit/specs/components/governance/TableProposals.spec.js index c925694d23..645b10aa83 100644 --- a/test/unit/specs/components/governance/TableProposals.spec.js +++ b/test/unit/specs/components/governance/TableProposals.spec.js @@ -3,34 +3,39 @@ import htmlBeautify from "html-beautify" import TableProposals from "renderer/components/governance/TableProposals" import lcdClientMock from "renderer/connectors/lcdClientMock.js" -let { proposals } = lcdClientMock.state +let { proposals, tallies } = lcdClientMock.state describe(`TableProposals`, () => { let wrapper, store let { mount } = setup() + const $store = { + commit: jest.fn(), + dispatch: jest.fn(), + getters: { + proposals: { proposals, tallies } + } + } + beforeEach(() => { let instance = mount(TableProposals, { - propsData: { - proposals, - loading: false - } + doBefore: ({ store }) => { + store.commit(`setConnected`, true) + store.state.user.address = `address1234` + store.commit(`setAtoms`, 1337) + for (const [proposal_id, tally_result] of Object.entries(tallies)) { + store.commit(`setProposalTally`, { proposal_id, tally_result }) + } + }, + propsData: { proposals }, + $store }) - wrapper = instance.wrapper store = instance.store - - store.commit(`setConnected`, true) - store.state.user.address = `address1234` - store.commit(`setAtoms`, 1337) wrapper.update() }) it(`has the expected html structure`, async () => { - // after importing the @tendermint/ui components from modules - // the perfect scroll plugin needs a $nextTick and a wrapper.update - // to work properly in the tests (snapshots weren't matching) - // this has occured across multiple tests await wrapper.vm.$nextTick() wrapper.update() expect(htmlBeautify(wrapper.html())).toMatchSnapshot() @@ -74,38 +79,25 @@ describe(`TableProposals`, () => { it(`should update 'somethingToSearch' when there's nothing to search`, () => { expect(wrapper.vm.somethingToSearch).toBe(true) - wrapper.setProps({ - proposals: {}, - loading: true - }) + wrapper.setProps({ proposals: {} }) expect(wrapper.vm.somethingToSearch).toBe(false) }) it(`should show placeholder if no items to display`, () => { let { wrapper } = mount(TableProposals, { - propsData: { - proposals: {}, - loading: true + doBefore: ({ store }) => { + store.commit(`setConnected`, true) + store.state.user.address = `address1234` + store.commit(`setAtoms`, 1337) }, + propsData: { proposals: {} }, stubs: { "data-empty-search": `` } }) expect(wrapper.contains(`data-empty-search`)).toBe(true) }) describe(`setSearch`, () => { - const $store = { - commit: jest.fn() - } - it(`should show search when there is something to search`, () => { - let { wrapper, store } = mount(TableProposals, { - propsData: { - proposals, - loading: false - }, - $store - }) - wrapper.vm.setSearch() expect(store.commit).toHaveBeenCalledWith(`setSearchVisible`, [ `proposals`, @@ -114,14 +106,7 @@ describe(`TableProposals`, () => { }) it(`should not show search when there is nothing to search`, () => { - let { wrapper, store } = mount(TableProposals, { - propsData: { - proposals: {}, - loading: false - }, - $store - }) - + wrapper.setProps({ proposals: {} }) wrapper.vm.setSearch() expect(store.commit).not.toHaveBeenCalledWith(`setSearchVisible`, [ `proposals`, diff --git a/test/unit/specs/components/governance/__snapshots__/LiProposal.spec.js.snap b/test/unit/specs/components/governance/__snapshots__/LiProposal.spec.js.snap index e8b75f3a6c..fd6034144c 100644 --- a/test/unit/specs/components/governance/__snapshots__/LiProposal.spec.js.snap +++ b/test/unit/specs/components/governance/__snapshots__/LiProposal.spec.js.snap @@ -11,58 +11,52 @@ exports[`LiProposal has the expected html structure 1`] = ` class="data-table__row__info__container" > - checkmark - + class="data-table__row__info__container__status green" + /> - Proposal Title + VotingPeriod proposal

- Proposal description + custom text proposal description

`; diff --git a/test/unit/specs/components/governance/__snapshots__/TableProposals.spec.js.snap b/test/unit/specs/components/governance/__snapshots__/TableProposals.spec.js.snap index 03f4f6a270..107802749a 100644 --- a/test/unit/specs/components/governance/__snapshots__/TableProposals.spec.js.snap +++ b/test/unit/specs/components/governance/__snapshots__/TableProposals.spec.js.snap @@ -45,10 +45,10 @@ exports[`TableProposals has the expected html structure 1`] = ` 30 @@ -70,10 +70,10 @@ exports[`TableProposals has the expected html structure 1`] = ` 0 @@ -95,10 +95,10 @@ exports[`TableProposals has the expected html structure 1`] = ` 0 @@ -120,10 +120,10 @@ exports[`TableProposals has the expected html structure 1`] = ` 25 @@ -249,17 +249,13 @@ exports[`TableProposals should filter the proposals 1`] = ` diff --git a/test/unit/specs/lcdClient.spec.js b/test/unit/specs/lcdClient.spec.js index d0edcb7e3e..1076ba0550 100644 --- a/test/unit/specs/lcdClient.spec.js +++ b/test/unit/specs/lcdClient.spec.js @@ -494,7 +494,7 @@ describe(`LCD Client`, () => { it(`queries a proposal's tally`, async () => { axios.mockReturnValue({}) - await client.queryProposalTally(`1`) + await client.getProposalTally(`1`) expect(axios.mock.calls).toEqual([ [ From ccdc3e5053b7bab72a8fa12a4bb2c940139267ab Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Thu, 20 Dec 2018 10:07:43 -0300 Subject: [PATCH 37/99] CHANGELOG --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d804322c7..b23fa76077 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -135,6 +135,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - [\#1676](https://github.com/cosmos/voyager/issues/1676) Reduced minWidth css for ModalVote to have 2 buttons per line @sabau - [\#1676](https://github.com/cosmos/voyager/issues/1670) Update balance in header after voting and depositing @faboweb - [\#1572](https://github.com/cosmos/voyager/issues/1572) Fixed scroll bug when switching between tabs @jbibla +- [\#1749](https://github.com/cosmos/voyager/issues/1749) Fixed proposal tally update after voting @fedekunze +- [\#1765](https://github.com/cosmos/voyager/pull/1765) Fixed proposal deposit update after submitting a deposit @fedekunze ## [0.10.7] - 2018-10-10 From 4385d33702fce7947f3d7dc947e566fa168db7e7 Mon Sep 17 00:00:00 2001 From: Federico Kunze <31522760+fedekunze@users.noreply.github.com> Date: Thu, 20 Dec 2018 10:15:01 -0300 Subject: [PATCH 38/99] Update proposals.spec.js --- test/unit/specs/store/governance/proposals.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/specs/store/governance/proposals.spec.js b/test/unit/specs/store/governance/proposals.spec.js index a5a17047eb..82a85f0cf4 100644 --- a/test/unit/specs/store/governance/proposals.spec.js +++ b/test/unit/specs/store/governance/proposals.spec.js @@ -135,7 +135,7 @@ describe(`Module: Proposals`, () => { node: { queryProposal: proposal_id => Promise.resolve({ value: proposals[proposal_id] }), - queryProposalTally: proposal_id => + getProposalTally: proposal_id => Promise.resolve(tallies[proposal_id]) } }) From 07e7c9880e25839c4dfea00ec521a72894d9e1bf Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Thu, 20 Dec 2018 10:17:23 -0300 Subject: [PATCH 39/99] fix prettier --- test/unit/specs/store/governance/proposals.spec.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/unit/specs/store/governance/proposals.spec.js b/test/unit/specs/store/governance/proposals.spec.js index 82a85f0cf4..1e74e1443b 100644 --- a/test/unit/specs/store/governance/proposals.spec.js +++ b/test/unit/specs/store/governance/proposals.spec.js @@ -135,8 +135,7 @@ describe(`Module: Proposals`, () => { node: { queryProposal: proposal_id => Promise.resolve({ value: proposals[proposal_id] }), - getProposalTally: proposal_id => - Promise.resolve(tallies[proposal_id]) + getProposalTally: proposal_id => Promise.resolve(tallies[proposal_id]) } }) From ba0973548a9f54c155e95df375e246804a8fb656 Mon Sep 17 00:00:00 2001 From: Karoly Albert Szabo Date: Thu, 20 Dec 2018 14:20:05 +0100 Subject: [PATCH 40/99] fix after discussion. Proper design will happen in staking-2 Signed-off-by: Karoly Albert Szabo --- .../components/staking/TabMyDelegations.vue | 46 +++++++++++-------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/app/src/renderer/components/staking/TabMyDelegations.vue b/app/src/renderer/components/staking/TabMyDelegations.vue index a8e1b6a1e5..ab5cfd673b 100644 --- a/app/src/renderer/components/staking/TabMyDelegations.vue +++ b/app/src/renderer/components/staking/TabMyDelegations.vue @@ -28,15 +28,6 @@ the validator list to find other validators to delegate to. -
-

- Unbonding validators - info_outline -

- -

Unbonding transactions @@ -47,14 +38,16 @@ info_outline

- +
+ +
@@ -128,7 +121,7 @@ export default { margin: 1rem 1rem 0 2rem; } .tab-header.transactions { - margin: 2rem; + margin: 2rem 0 1rem 2rem; } .info-button { @@ -140,9 +133,24 @@ export default { border: 1px solid var(--bc-dim); border-radius: 0.25rem; font-size: var(--sm); - margin-bottom: 4rem; margin-left: 2rem; padding: 0.5rem; text-align: center; } + +.transactions { + margin-left: 2rem; + counter-reset: transaction; +} +.transactions .tm-li-tx { + counter-increment: transaction; +} +.tm-li-tx::before { + content: counter(transaction); + position: absolute; + width: 2rem; + text-align: right; + color: var(--dim); + left: 0; +} From 54f7cb802961d03c84844ab1742a1fb5524b38c4 Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Thu, 20 Dec 2018 11:27:47 -0300 Subject: [PATCH 41/99] increase cov --- test/unit/specs/store/governance/proposals.spec.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/unit/specs/store/governance/proposals.spec.js b/test/unit/specs/store/governance/proposals.spec.js index 1e74e1443b..3468448961 100644 --- a/test/unit/specs/store/governance/proposals.spec.js +++ b/test/unit/specs/store/governance/proposals.spec.js @@ -143,6 +143,7 @@ describe(`Module: Proposals`, () => { let commit = jest.fn() let dispatch = jest.fn() + // not on VotingPeriod await actions.getProposal( { state, commit, dispatch, rootState: mockRootState }, `1` @@ -151,6 +152,16 @@ describe(`Module: Proposals`, () => { [`setProposal`, proposals[`1`]], [`setProposalTally`, { proposal_id: `1`, tally_result: tallies[`1`] }] ]) + + // on VotingPeriod + await actions.getProposal( + { state, commit, dispatch, rootState: mockRootState }, + `2` + ) + expect(commit.mock.calls.slice(2)).toEqual([ + [`setProposal`, proposals[`2`]], + [`setProposalTally`, { proposal_id: `2`, tally_result: tallies[`2`] }] + ]) }) it(`throws and stores error if the request fails`, async () => { From e04403d44a1e55daa6f79d367b4c068f19f317cc Mon Sep 17 00:00:00 2001 From: Federico Kunze <31522760+fedekunze@users.noreply.github.com> Date: Thu, 20 Dec 2018 11:35:08 -0300 Subject: [PATCH 42/99] Update PageProposal.spec.js --- test/unit/specs/components/governance/PageProposal.spec.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/unit/specs/components/governance/PageProposal.spec.js b/test/unit/specs/components/governance/PageProposal.spec.js index 2267cc8b66..e22c6779ef 100644 --- a/test/unit/specs/components/governance/PageProposal.spec.js +++ b/test/unit/specs/components/governance/PageProposal.spec.js @@ -130,7 +130,6 @@ describe(`PageProposal`, () => { it(`enables voting if the proposal is on the 'VotingPeriod'`, () => { let proposal = proposals[`2`] proposal.proposal_status = `VotingPeriod` - console.log(proposal.proposal_status) let instance = mount(PageProposal, { localVue, doBefore: ({ router, store }) => { From d605061ae2751202dad94f20f835a195d69e4c0e Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Thu, 20 Dec 2018 21:45:45 -0300 Subject: [PATCH 43/99] remove updates from other branch --- .../renderer/components/governance/ModalDeposit.vue | 11 +++++++++-- .../renderer/components/governance/ModalPropose.vue | 12 +++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/app/src/renderer/components/governance/ModalDeposit.vue b/app/src/renderer/components/governance/ModalDeposit.vue index 747c1120fb..9933c90e1b 100644 --- a/app/src/renderer/components/governance/ModalDeposit.vue +++ b/app/src/renderer/components/governance/ModalDeposit.vue @@ -25,11 +25,18 @@ type="text" readonly="readonly" /> - + diff --git a/app/src/renderer/components/governance/ModalPropose.vue b/app/src/renderer/components/governance/ModalPropose.vue index abd41e34db..f6c0dcb800 100644 --- a/app/src/renderer/components/governance/ModalPropose.vue +++ b/app/src/renderer/components/governance/ModalPropose.vue @@ -56,11 +56,17 @@ type="text" readonly="readonly" /> - + @@ -176,7 +182,7 @@ export default { amount: { required, isInteger, - between: between(1, this.balance > 0 ? this.balance : null) + between: between(1, this.balance > 0 ? this.balance : 1) }, password: { required From 25a0e097c6134d43716e0f3c46ee2c0c537c88c0 Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Thu, 20 Dec 2018 21:47:17 -0300 Subject: [PATCH 44/99] rm builds --- .../cli_home_1/keys/keys.db/000002.ldb | Bin 478 -> 0 bytes .../cli_home_1/keys/keys.db/000003.log | 0 .../testnets/cli_home_1/keys/keys.db/CURRENT | 1 - .../cli_home_1/keys/keys.db/CURRENT.bak | 1 - .../testnets/cli_home_1/keys/keys.db/LOCK | 0 .../testnets/cli_home_1/keys/keys.db/LOG | 16 -- .../cli_home_1/keys/keys.db/MANIFEST-000004 | Bin 219 -> 0 bytes .../testnets/node_home_1/config/config.toml | 249 ------------------ .../testnets/node_home_1/config/gaiad.toml | 7 - .../node_home_1/config/gaiaversion.txt | 1 - .../testnets/node_home_1/config/genesis.json | 180 ------------- ...f092a72aea073694219496c2e0b2a1f442860.json | 41 --- .../testnets/node_home_1/config/node_key.json | 6 - .../node_home_1/config/priv_validator.json | 14 - 14 files changed, 516 deletions(-) delete mode 100644 tasks/builds/testnets/cli_home_1/keys/keys.db/000002.ldb delete mode 100644 tasks/builds/testnets/cli_home_1/keys/keys.db/000003.log delete mode 100644 tasks/builds/testnets/cli_home_1/keys/keys.db/CURRENT delete mode 100644 tasks/builds/testnets/cli_home_1/keys/keys.db/CURRENT.bak delete mode 100644 tasks/builds/testnets/cli_home_1/keys/keys.db/LOCK delete mode 100644 tasks/builds/testnets/cli_home_1/keys/keys.db/LOG delete mode 100644 tasks/builds/testnets/cli_home_1/keys/keys.db/MANIFEST-000004 delete mode 100644 tasks/builds/testnets/node_home_1/config/config.toml delete mode 100644 tasks/builds/testnets/node_home_1/config/gaiad.toml delete mode 100644 tasks/builds/testnets/node_home_1/config/gaiaversion.txt delete mode 100644 tasks/builds/testnets/node_home_1/config/genesis.json delete mode 100644 tasks/builds/testnets/node_home_1/config/gentx/gentx-dc2f092a72aea073694219496c2e0b2a1f442860.json delete mode 100644 tasks/builds/testnets/node_home_1/config/node_key.json delete mode 100644 tasks/builds/testnets/node_home_1/config/priv_validator.json diff --git a/tasks/builds/testnets/cli_home_1/keys/keys.db/000002.ldb b/tasks/builds/testnets/cli_home_1/keys/keys.db/000002.ldb deleted file mode 100644 index 2ae17380c32d4e73c60daa097f6e3073e022a4d2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 478 zcmbQi{2`ISmNz-SI5)r8Fx|{3H>WJMq&PRXBqu#9BhSDx)uOT}r_w0hxU|T~BBi)2 zxx!R0F(suawYZp(i2)2si&Km85_41aGV{{%8AMkxp$ITCGB7ZzE39DRT`OwK#Zk(u z_rXUr!4UDw5 z^8?I1T~iGWT#ZZ%b0Z?6T!NGQ{4Byf!z;2&J^cN=a!QO0GYT@@BLiK_xSS%rvVye( zLJT6j%ia7Py-VG-JzOLFoGpyPD^n_r{EYO2inCk{Y`JWG%L|gZ7+3P>0=2F#03QXB{_o5}nM;vx*3%w>%KIT;#C Jty1cK8vw*bh57&h diff --git a/tasks/builds/testnets/cli_home_1/keys/keys.db/000003.log b/tasks/builds/testnets/cli_home_1/keys/keys.db/000003.log deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tasks/builds/testnets/cli_home_1/keys/keys.db/CURRENT b/tasks/builds/testnets/cli_home_1/keys/keys.db/CURRENT deleted file mode 100644 index cacca7574c..0000000000 --- a/tasks/builds/testnets/cli_home_1/keys/keys.db/CURRENT +++ /dev/null @@ -1 +0,0 @@ -MANIFEST-000004 diff --git a/tasks/builds/testnets/cli_home_1/keys/keys.db/CURRENT.bak b/tasks/builds/testnets/cli_home_1/keys/keys.db/CURRENT.bak deleted file mode 100644 index feda7d6b24..0000000000 --- a/tasks/builds/testnets/cli_home_1/keys/keys.db/CURRENT.bak +++ /dev/null @@ -1 +0,0 @@ -MANIFEST-000000 diff --git a/tasks/builds/testnets/cli_home_1/keys/keys.db/LOCK b/tasks/builds/testnets/cli_home_1/keys/keys.db/LOCK deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tasks/builds/testnets/cli_home_1/keys/keys.db/LOG b/tasks/builds/testnets/cli_home_1/keys/keys.db/LOG deleted file mode 100644 index c6fe1cc9a6..0000000000 --- a/tasks/builds/testnets/cli_home_1/keys/keys.db/LOG +++ /dev/null @@ -1,16 +0,0 @@ -=============== Dec 19, 2018 (-03) =============== -12:29:14.496300 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed -12:29:14.497111 db@open opening -12:29:14.497398 version@stat F·[] S·0B[] Sc·[] -12:29:14.497816 db@janitor F·2 G·0 -12:29:14.497861 db@open done T·728.141µs -=============== Dec 19, 2018 (-03) =============== -12:29:14.836150 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed -12:29:14.836413 version@stat F·[] S·0B[] Sc·[] -12:29:14.836439 db@open opening -12:29:14.836515 journal@recovery F·1 -12:29:14.836636 journal@recovery recovering @1 -12:29:14.837227 memdb@flush created L0@2 N·2 S·478B "cos..ess,v2":"use..nfo,v1" -12:29:14.837659 version@stat F·[1] S·478B[478B] Sc·[0.25] -12:29:14.839159 db@janitor F·3 G·0 -12:29:14.839194 db@open done T·2.741569ms diff --git a/tasks/builds/testnets/cli_home_1/keys/keys.db/MANIFEST-000004 b/tasks/builds/testnets/cli_home_1/keys/keys.db/MANIFEST-000004 deleted file mode 100644 index 78018e82ad9b9294865633d558277348c238d968..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 219 zcmZ1#xoPbc21Z7yoYb<^oRlOzr^=Gl^338?=ltA)#G=HK{30f1W>ywvb_S+<%(lt- z#ku*#hUsQTxjAL2CB?b9B{}I?8F>blsTP$*Ih97~#-&9@7AeJL$rYx0i76>Xsl~;N cOblQkT3Vc1l$V&Bs+XCUme0rt5v7^I0B|KjwEzGB diff --git a/tasks/builds/testnets/node_home_1/config/config.toml b/tasks/builds/testnets/node_home_1/config/config.toml deleted file mode 100644 index 3b2de5b72d..0000000000 --- a/tasks/builds/testnets/node_home_1/config/config.toml +++ /dev/null @@ -1,249 +0,0 @@ -# This is a TOML config file. -# For more information, see https://github.com/toml-lang/toml - -##### main base config options ##### - -# TCP or UNIX socket address of the ABCI application, -# or the name of an ABCI application compiled in with the Tendermint binary -proxy_app = "tcp://127.0.0.1:26658" - -# A custom human readable name for this node -moniker = "local_1" - -# If this node is many blocks behind the tip of the chain, FastSync -# allows them to catchup quickly by downloading blocks in parallel -# and verifying their commits -fast_sync = true - -# Database backend: leveldb | memdb | cleveldb -db_backend = "leveldb" - -# Database directory -db_dir = "data" - -# Output level for logging, including package level options -log_level = "main:info,state:info,*:error" - -# Output format: 'plain' (colored text) or 'json' -log_format = "plain" - -##### additional base config options ##### - -# Path to the JSON file containing the initial validator set and other meta data -genesis_file = "config/genesis.json" - -# Path to the JSON file containing the private key to use as a validator in the consensus protocol -priv_validator_file = "config/priv_validator.json" - -# TCP or UNIX socket address for Tendermint to listen on for -# connections from an external PrivValidator process -priv_validator_laddr = "" - -# Path to the JSON file containing the private key to use for node authentication in the p2p protocol -node_key_file = "config/node_key.json" - -# Mechanism to connect to the ABCI application: socket | grpc -abci = "socket" - -# TCP or UNIX socket address for the profiling server to listen on -prof_laddr = "localhost:6060" - -# If true, query the ABCI app on connecting to a new peer -# so the app can decide if we should keep the connection or not -filter_peers = false - -##### advanced configuration options ##### - -##### rpc server configuration options ##### -[rpc] - -# TCP or UNIX socket address for the RPC server to listen on -laddr = "tcp://0.0.0.0:26657" - -# A list of origins a cross-domain request can be executed from -# Default value '[]' disables cors support -# Use '["*"]' to allow any origin -cors_allowed_origins = "[[]]" - -# A list of methods the client is allowed to use with cross-domain requests -cors_allowed_methods = "[[HEAD GET POST] GET POST]" - -# A list of non simple headers the client is allowed to use with cross-domain requests -cors_allowed_headers = "[[Origin Accept Content-Type X-Requested-With X-Server-Time] Accept Content-Type X-Requested-With X-Server-Time]" - -# TCP or UNIX socket address for the gRPC server to listen on -# NOTE: This server only supports /broadcast_tx_commit -grpc_laddr = "" - -# Maximum number of simultaneous connections. -# Does not include RPC (HTTP&WebSocket) connections. See max_open_connections -# If you want to accept more significant number than the default, make sure -# you increase your OS limits. -# 0 - unlimited. -# Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files} -# 1024 - 40 - 10 - 50 = 924 = ~900 -grpc_max_open_connections = 900 - -# Activate unsafe RPC commands like /dial_seeds and /unsafe_flush_mempool -unsafe = false - -# Maximum number of simultaneous connections (including WebSocket). -# Does not include gRPC connections. See grpc_max_open_connections -# If you want to accept more significant number than the default, make sure -# you increase your OS limits. -# 0 - unlimited. -# Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files} -# 1024 - 40 - 10 - 50 = 924 = ~900 -max_open_connections = 900 - -##### peer to peer configuration options ##### -[p2p] - -# Address to listen for incoming connections -laddr = "tcp://0.0.0.0:26656" - -# Address to advertise to peers for them to dial -# If empty, will use the same port as the laddr, -# and will introspect on the listener or use UPnP -# to figure out the address. -external_address = "" - -# Comma separated list of seed nodes to connect to -seeds = "" - -# Comma separated list of nodes to keep persistent connections to -persistent_peers = "" - -# UPNP port forwarding -upnp = false - -# Path to address book -addr_book_file = "config/addrbook.json" - -# Set true for strict address routability rules -# Set false for private or local networks -addr_book_strict = true - -# Maximum number of inbound peers -max_num_inbound_peers = 40 - -# Maximum number of outbound peers to connect to, excluding persistent peers -max_num_outbound_peers = 10 - -# Time to wait before flushing messages out on the connection -flush_throttle_timeout = "100ms" - -# Maximum size of a message packet payload, in bytes -max_packet_msg_payload_size = 1024 - -# Rate at which packets can be sent, in bytes/second -send_rate = 5120000 - -# Rate at which packets can be received, in bytes/second -recv_rate = 5120000 - -# Set true to enable the peer-exchange reactor -pex = true - -# Seed mode, in which node constantly crawls the network and looks for -# peers. If another node asks it for addresses, it responds and disconnects. -# -# Does not work if the peer-exchange reactor is disabled. -seed_mode = false - -# Comma separated list of peer IDs to keep private (will not be gossiped to other peers) -private_peer_ids = "" - -# Toggle to disable guard against peers connecting from the same ip. -allow_duplicate_ip = true - -# Peer connection configuration. -handshake_timeout = "20s" -dial_timeout = "3s" - -##### mempool configuration options ##### -[mempool] - -recheck = true -broadcast = true -wal_dir = "" - -# size of the mempool -size = 5000 - -# size of the cache (used to filter transactions we saw earlier) -cache_size = 10000 - -##### consensus configuration options ##### -[consensus] - -wal_file = "data/cs.wal/wal" - -timeout_propose = "3s" -timeout_propose_delta = "500ms" -timeout_prevote = "1s" -timeout_prevote_delta = "500ms" -timeout_precommit = "1s" -timeout_precommit_delta = "500ms" -timeout_commit = "5s" - -# Make progress as soon as we have all the precommits (as if TimeoutCommit = 0) -skip_timeout_commit = false - -# EmptyBlocks mode and possible interval between empty blocks -create_empty_blocks = true -create_empty_blocks_interval = "0s" - -# Reactor sleep duration parameters -peer_gossip_sleep_duration = "100ms" -peer_query_maj23_sleep_duration = "2s" - -# Block time parameters. Corresponds to the minimum time increment between consecutive blocks. -blocktime_iota = "1s" - -##### transactions indexer configuration options ##### -[tx_index] - -# What indexer to use for transactions -# -# Options: -# 1) "null" (default) -# 2) "kv" - the simplest possible indexer, backed by key-value storage (defaults to levelDB; see DBBackend). -indexer = "kv" - -# Comma-separated list of tags to index (by default the only tag is "tx.hash") -# -# You can also index transactions by height by adding "tx.height" tag here. -# -# It's recommended to index only a subset of tags due to possible memory -# bloat. This is, of course, depends on the indexer's DB and the volume of -# transactions. -index_tags = "" - -# When set to true, tells indexer to index all tags (predefined tags: -# "tx.hash", "tx.height" and all tags from DeliverTx responses). -# -# Note this may be not desirable (see the comment above). IndexTags has a -# precedence over IndexAllTags (i.e. when given both, IndexTags will be -# indexed). -index_all_tags = true - -##### instrumentation configuration options ##### -[instrumentation] - -# When true, Prometheus metrics are served under /metrics on -# PrometheusListenAddr. -# Check out the documentation for the list of available metrics. -prometheus = false - -# Address to listen for Prometheus collector(s) connections -prometheus_listen_addr = ":26660" - -# Maximum number of simultaneous connections. -# If you want to accept more significant number than the default, make sure -# you increase your OS limits. -# 0 - unlimited. -max_open_connections = 3 - -# Instrumentation namespace -namespace = "tendermint" diff --git a/tasks/builds/testnets/node_home_1/config/gaiad.toml b/tasks/builds/testnets/node_home_1/config/gaiad.toml deleted file mode 100644 index dd505c2590..0000000000 --- a/tasks/builds/testnets/node_home_1/config/gaiad.toml +++ /dev/null @@ -1,7 +0,0 @@ -# This is a TOML config file. -# For more information, see https://github.com/toml-lang/toml - -##### main base config options ##### - -# Validators reject any tx from the mempool with less than the minimum fee per gas. -minimum_fees = "" diff --git a/tasks/builds/testnets/node_home_1/config/gaiaversion.txt b/tasks/builds/testnets/node_home_1/config/gaiaversion.txt deleted file mode 100644 index f589efd34a..0000000000 --- a/tasks/builds/testnets/node_home_1/config/gaiaversion.txt +++ /dev/null @@ -1 +0,0 @@ -0.28.0-rc2-0-g945803d5 diff --git a/tasks/builds/testnets/node_home_1/config/genesis.json b/tasks/builds/testnets/node_home_1/config/genesis.json deleted file mode 100644 index 4ab1deb257..0000000000 --- a/tasks/builds/testnets/node_home_1/config/genesis.json +++ /dev/null @@ -1,180 +0,0 @@ -{ - "genesis_time": "2018-12-19T15:29:15.145318Z", - "chain_id": "default-testnet", - "consensus_params": { - "block_size": { - "max_bytes": "22020096", - "max_gas": "-1" - }, - "evidence": { - "max_age": "100000" - }, - "validator": { - "pub_key_types": ["ed25519"] - } - }, - "app_hash": "", - "app_state": { - "accounts": [ - { - "address": "cosmos1g62mlvetsmmtlgjhn09e8yrly2g3ur28dsvcx5", - "coins": [ - { - "denom": "STAKE", - "amount": "150" - }, - { - "denom": "localcoin", - "amount": "1000" - } - ], - "sequence_number": "0", - "account_number": "0" - } - ], - "auth": { - "collected_fees": null - }, - "stake": { - "pool": { - "loose_tokens": "150.0000000000", - "bonded_tokens": "0.0000000000" - }, - "params": { - "unbonding_time": "259200000000000", - "max_validators": 100, - "bond_denom": "STAKE" - }, - "last_total_power": "0", - "last_validator_powers": null, - "validators": null, - "bonds": null, - "unbonding_delegations": null, - "redelegations": null, - "exported": false - }, - "mint": { - "minter": { - "inflation": "0.1300000000", - "annual_provisions": "0.0000000000" - }, - "params": { - "mint_denom": "STAKE", - "inflation_rate_change": "0.1300000000", - "inflation_max": "0.2000000000", - "inflation_min": "0.0700000000", - "goal_bonded": "0.6700000000", - "blocks_per_year": "6311520" - } - }, - "distr": { - "fee_pool": { - "val_accum": { - "update_height": "0", - "accum": "0.0000000000" - }, - "val_pool": null, - "community_pool": null - }, - "community_tax": "0.0200000000", - "base_proposer_reward": "0.0100000000", - "bonus_proposer_reward": "0.0400000000", - "validator_dist_infos": null, - "delegator_dist_infos": null, - "delegator_withdraw_infos": null, - "previous_proposer": "cosmosvalcons1m46yrx" - }, - "gov": { - "starting_proposal_id": "1", - "deposits": null, - "votes": null, - "proposals": null, - "deposit_params": { - "min_deposit": [ - { - "denom": "STAKE", - "amount": "10" - } - ], - "max_deposit_period": "172800000000000" - }, - "voting_params": { - "voting_period": "172800000000000" - }, - "tally_params": { - "quorum": "0.3340000000", - "threshold": "0.5000000000", - "veto": "0.3340000000", - "governance_penalty": "0.0100000000" - } - }, - "slashing": { - "params": { - "max-evidence-age": "120000000000", - "signed-blocks-window": "100", - "min-signed-per-window": "0.5000000000", - "double-sign-unbond-duration": "300000000000", - "downtime-unbond-duration": "600000000000", - "slash-fraction-double-sign": "0.0500000000", - "slash-fraction-downtime": "0.0100000000" - }, - "signing_infos": {}, - "missed_blocks": {}, - "slashing_periods": null - }, - "gentxs": [ - { - "type": "auth/StdTx", - "value": { - "msg": [ - { - "type": "cosmos-sdk/MsgCreateValidator", - "value": { - "Description": { - "moniker": "local_1", - "identity": "", - "website": "", - "details": "" - }, - "Commission": { - "rate": "0.1000000000", - "max_rate": "0.2000000000", - "max_change_rate": "0.0100000000" - }, - "delegator_address": "cosmos1g62mlvetsmmtlgjhn09e8yrly2g3ur28dsvcx5", - "validator_address": "cosmosvaloper1g62mlvetsmmtlgjhn09e8yrly2g3ur28gycd28", - "pubkey": { - "type": "tendermint/PubKeyEd25519", - "value": "xaw5RhyeOsHRpqQbwpbkbDPvWLLMp0XAuMOxjrhBqsQ=" - }, - "delegation": { - "denom": "STAKE", - "amount": "100" - } - } - } - ], - "fee": { - "amount": [ - { - "denom": "", - "amount": "0" - } - ], - "gas": "200000" - }, - "signatures": [ - { - "pub_key": { - "type": "tendermint/PubKeySecp256k1", - "value": "Akjnzjcl9yTu2KESe36E/D2BIz360ucNS1Uucv52akJ2" - }, - "signature": "E5zW/5KQQIwg1Y4PXgDvACatm0eJxTDWW2h5fsTClttJFhV/4gGLlYhoZT6sAbTmE5ZcXzjKocB7Le/AcA23xg==" - } - ], - "memo": "dc2f092a72aea073694219496c2e0b2a1f442860@192.168.0.188:26656" - } - } - ] - } -} diff --git a/tasks/builds/testnets/node_home_1/config/gentx/gentx-dc2f092a72aea073694219496c2e0b2a1f442860.json b/tasks/builds/testnets/node_home_1/config/gentx/gentx-dc2f092a72aea073694219496c2e0b2a1f442860.json deleted file mode 100644 index 42376f67fe..0000000000 --- a/tasks/builds/testnets/node_home_1/config/gentx/gentx-dc2f092a72aea073694219496c2e0b2a1f442860.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "type": "auth/StdTx", - "value": { - "msg": [ - { - "type": "cosmos-sdk/MsgCreateValidator", - "value": { - "Description": { - "moniker": "local_1", - "identity": "", - "website": "", - "details": "" - }, - "Commission": { - "rate": "0.1000000000", - "max_rate": "0.2000000000", - "max_change_rate": "0.0100000000" - }, - "delegator_address": "cosmos1g62mlvetsmmtlgjhn09e8yrly2g3ur28dsvcx5", - "validator_address": "cosmosvaloper1g62mlvetsmmtlgjhn09e8yrly2g3ur28gycd28", - "pubkey": { - "type": "tendermint/PubKeyEd25519", - "value": "xaw5RhyeOsHRpqQbwpbkbDPvWLLMp0XAuMOxjrhBqsQ=" - }, - "delegation": { "denom": "STAKE", "amount": "100" } - } - } - ], - "fee": { "amount": [{ "denom": "", "amount": "0" }], "gas": "200000" }, - "signatures": [ - { - "pub_key": { - "type": "tendermint/PubKeySecp256k1", - "value": "Akjnzjcl9yTu2KESe36E/D2BIz360ucNS1Uucv52akJ2" - }, - "signature": "E5zW/5KQQIwg1Y4PXgDvACatm0eJxTDWW2h5fsTClttJFhV/4gGLlYhoZT6sAbTmE5ZcXzjKocB7Le/AcA23xg==" - } - ], - "memo": "dc2f092a72aea073694219496c2e0b2a1f442860@192.168.0.188:26656" - } -} diff --git a/tasks/builds/testnets/node_home_1/config/node_key.json b/tasks/builds/testnets/node_home_1/config/node_key.json deleted file mode 100644 index 56d259681f..0000000000 --- a/tasks/builds/testnets/node_home_1/config/node_key.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "priv_key": { - "type": "tendermint/PrivKeyEd25519", - "value": "mIJRgWx2vFFPfow0TEwPdU5VHeG69286nGN1Gf9/O9I4DoRNkNKDsdl83lDnV4rDqGE450xj4KyWQKiEVGazqw==" - } -} diff --git a/tasks/builds/testnets/node_home_1/config/priv_validator.json b/tasks/builds/testnets/node_home_1/config/priv_validator.json deleted file mode 100644 index e46ffba671..0000000000 --- a/tasks/builds/testnets/node_home_1/config/priv_validator.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "address": "B49D9A0D26902D38D380DB86EC73A19E4876AEDE", - "pub_key": { - "type": "tendermint/PubKeyEd25519", - "value": "xaw5RhyeOsHRpqQbwpbkbDPvWLLMp0XAuMOxjrhBqsQ=" - }, - "last_height": "0", - "last_round": "0", - "last_step": 0, - "priv_key": { - "type": "tendermint/PrivKeyEd25519", - "value": "X+R5CqsWgZZhw04pFK19WjoF5fldqNd7o7Oe1NAA89bFrDlGHJ46wdGmpBvCluRsM+9YssynRcC4w7GOuEGqxA==" - } -} From de71702e7cc512114bff73a3cd1efb3411a21f83 Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Thu, 20 Dec 2018 22:22:13 -0300 Subject: [PATCH 45/99] removed bondingDenom --- .../renderer/components/common/TmBalance.vue | 6 ++-- .../components/common/TmOnboarding.vue | 8 +++-- .../components/governance/PageGovernance.vue | 1 - .../components/governance/PageProposal.vue | 1 - .../components/staking/DelegationModal.vue | 4 +-- .../components/staking/PageValidator.vue | 29 +++++++++++++------ .../components/staking/TabMyDelegations.vue | 6 ++-- .../components/staking/TabParameters.vue | 22 ++------------ .../components/staking/TableValidators.vue | 10 +++---- .../components/staking/UndelegationModal.vue | 4 +-- .../components/wallet/PageTransactions.vue | 4 +-- app/src/renderer/connectors/lcdClientMock.js | 14 +++++---- app/src/renderer/vuex/getters.js | 3 -- app/src/renderer/vuex/modules/config.js | 2 -- app/src/renderer/vuex/modules/delegation.js | 4 +-- app/src/renderer/vuex/modules/wallet.js | 4 ++- .../staking/DelegationModal.spec.js | 3 +- .../components/staking/PageValidator.spec.js | 29 +++++++++++-------- .../staking/TabMyDelegations.spec.js | 10 +++---- .../staking/UndelegationModal.spec.js | 3 +- .../TabMyDelegations.spec.js.snap | 10 +++---- test/unit/specs/store/delegation.spec.js | 10 ++----- .../unit/specs/store/governance/votes.spec.js | 6 ++-- 23 files changed, 94 insertions(+), 99 deletions(-) diff --git a/app/src/renderer/components/common/TmBalance.vue b/app/src/renderer/components/common/TmBalance.vue index 3ae6efc92c..742c6c9168 100644 --- a/app/src/renderer/components/common/TmBalance.vue +++ b/app/src/renderer/components/common/TmBalance.vue @@ -5,11 +5,11 @@
-

Total {{ bondingDenom }}

+

Total {{ stakingParameters.parameters.bond_denom }}

{{ num.shortNumber(totalAtoms) }}

-

Available {{ bondingDenom }}

+

Available {{ stakingParameters.parameters.bond_denom }}

{{ unbondedAtoms }}

@@ -51,7 +51,7 @@ export default { } }, computed: { - ...mapGetters([`bondingDenom`, `user`, `totalAtoms`]), + ...mapGetters([`user`, `totalAtoms`, `stakingParameters`]), address() { return this.user.address }, diff --git a/app/src/renderer/components/common/TmOnboarding.vue b/app/src/renderer/components/common/TmOnboarding.vue index 74eda0b1d9..771c9e19f4 100644 --- a/app/src/renderer/components/common/TmOnboarding.vue +++ b/app/src/renderer/components/common/TmOnboarding.vue @@ -48,7 +48,7 @@ export default { name: `tm-onboarding`, components: { TmBtn, TmBarDiscrete }, computed: { - ...mapGetters([`onboarding`, `bondingDenom`]), + ...mapGetters([`onboarding`, `stakingParameters`]), activeKey() { return this.onboarding.state }, @@ -57,8 +57,10 @@ export default { `This is a quick tour of the primary features of Cosmos Voyager.`, `You can send and receive Cosmos tokens from anyone around the world.`, `You can delegate your ${ - this.bondingDenom - } to Cosmos Validators to earn even more ${this.bondingDenom}.`, + this.stakingParameters.parameters.bond_denom + } to Cosmos Validators to earn even more ${ + this.stakingParameters.parameters.bond_denom + }.`, `Through governance, you can vote on the future of the Cosmos Network.`, `Start using Voyager to explore the Cosmos Network!` ] diff --git a/app/src/renderer/components/governance/PageGovernance.vue b/app/src/renderer/components/governance/PageGovernance.vue index 9ef2c6b11c..b8dfad2c75 100644 --- a/app/src/renderer/components/governance/PageGovernance.vue +++ b/app/src/renderer/components/governance/PageGovernance.vue @@ -67,7 +67,6 @@ export default { ...mapGetters([ `proposals`, `filters`, - `bondingDenom`, `connected`, `governanceParameters` ]), diff --git a/app/src/renderer/components/governance/PageProposal.vue b/app/src/renderer/components/governance/PageProposal.vue index 6af4ba8096..1af6c24eb2 100644 --- a/app/src/renderer/components/governance/PageProposal.vue +++ b/app/src/renderer/components/governance/PageProposal.vue @@ -260,7 +260,6 @@ export default { }) this.proposal = this.proposals.proposals[this.proposalId] - // TODO: get min deposit denom from gov params this.$store.commit(`notify`, { title: `Successful deposit!`, body: `You have successfully deposited your ${ diff --git a/app/src/renderer/components/staking/DelegationModal.vue b/app/src/renderer/components/staking/DelegationModal.vue index a45be574ae..cdb1f45af5 100644 --- a/app/src/renderer/components/staking/DelegationModal.vue +++ b/app/src/renderer/components/staking/DelegationModal.vue @@ -17,7 +17,7 @@ > @@ -128,7 +128,7 @@ export default { showPassword: false }), computed: { - ...mapGetters([`bondingDenom`]) + ...mapGetters([`stakingParameters`]) }, validations() { return { diff --git a/app/src/renderer/components/staking/PageValidator.vue b/app/src/renderer/components/staking/PageValidator.vue index c9cf72a5e0..3e3a495109 100644 --- a/app/src/renderer/components/staking/PageValidator.vue +++ b/app/src/renderer/components/staking/PageValidator.vue @@ -57,7 +57,7 @@
-
Delegated {{ bondingDenom }}
+
Delegated {{ stakingParameters.parameters.bond_denom }}
{{ myBond.isLessThan(0.01) && myBond.isGreaterThan(0) @@ -155,11 +155,16 @@
-
Self Delegated {{ bondingDenom }}
+
+ Self Delegated {{ stakingParameters.parameters.bond_denom }} +
{{ selfBond }} %
-
Minimum Self Delegated {{ bondingDenom }}
+
+ Minimum Self Delegated + {{ stakingParameters.parameters.bond_denom }} +
0 %
@@ -184,7 +189,7 @@ Cannot {{ action == `delegate` ? `Delegate` : `Undelegate` }}

- You have no {{ bondingDenom }}s + You have no {{ stakingParameters.parameters.bond_denom }}s {{ action == `undelegate` ? ` delegated ` : ` ` }}to {{ action == `delegate` ? ` delegate.` : ` this validator.` }}

@@ -243,7 +248,7 @@ export default { }), computed: { ...mapGetters([ - `bondingDenom`, + `stakingParameters`, `delegates`, `delegation`, `committedDelegations`, @@ -389,11 +394,15 @@ export default { this.$store.commit(`notify`, { title: `Successful ${txTitle}!`, - body: `You have successfully ${txBody} your ${this.bondingDenom}s` + body: `You have successfully ${txBody} your ${ + this.stakingParameters.parameters.bond_denom + }s` }) } catch ({ message }) { this.$store.commit(`notifyError`, { - title: `Error while ${txAction} ${this.bondingDenom}s`, + title: `Error while ${txAction} ${ + this.stakingParameters.parameters.bond_denom + }s`, body: message }) } @@ -415,12 +424,14 @@ export default { this.$store.commit(`notify`, { title: `Successful Undelegation!`, body: `You have successfully undelegated ${amount} ${ - this.bondingDenom + this.stakingParameters.parameters.bond_denom }s.` }) } catch ({ message }) { this.$store.commit(`notifyError`, { - title: `Error while undelegating ${this.bondingDenom}s`, + title: `Error while undelegating ${ + this.stakingParameters.parameters.bond_denom + }s`, body: message }) } diff --git a/app/src/renderer/components/staking/TabMyDelegations.vue b/app/src/renderer/components/staking/TabMyDelegations.vue index 40f8f0f9c9..15319615db 100644 --- a/app/src/renderer/components/staking/TabMyDelegations.vue +++ b/app/src/renderer/components/staking/TabMyDelegations.vue @@ -8,8 +8,8 @@
No Active Delegations
- Looks like you haven't delegated any {{ bondingDenom }}s yet. Head over - to the + Looks like you haven't delegated any + {{ stakingParameters.parameters.bond_denom }}s yet. Head over to the validator list to make your first delegation!
@@ -52,7 +52,7 @@ export default { `delegates`, `delegation`, `committedDelegations`, - `bondingDenom`, + `stakingParameters`, `connected` ]), undelegatedValidators( diff --git a/app/src/renderer/components/staking/TabParameters.vue b/app/src/renderer/components/staking/TabParameters.vue index b4ca0e0d2d..5d82ed6968 100644 --- a/app/src/renderer/components/staking/TabParameters.vue +++ b/app/src/renderer/components/staking/TabParameters.vue @@ -24,12 +24,7 @@
- Loose - {{ - stakingParameters.parameters.bond_denom - ? stakingParameters.parameters.bond_denom - : bondingDenom - }} + Loose {{ stakingParameters.parameters.bond_denom }}
- Delegated - {{ - stakingParameters.parameters.bond_denom - ? stakingParameters.parameters.bond_denom - : bondingDenom - }} + Delegated {{ stakingParameters.parameters.bond_denom }} @@ -117,7 +117,7 @@ export default { showPassword: false }), computed: { - ...mapGetters([`bondingDenom`]) + ...mapGetters([`stakingParameters`]) }, validations() { return { diff --git a/app/src/renderer/components/wallet/PageTransactions.vue b/app/src/renderer/components/wallet/PageTransactions.vue index 657856ac16..54e108441d 100644 --- a/app/src/renderer/components/wallet/PageTransactions.vue +++ b/app/src/renderer/components/wallet/PageTransactions.vue @@ -32,7 +32,7 @@ :key="tx.hash" :transaction="tx" :address="wallet.address" - :bonding-denom="bondingDenom" + :bonding-denom="stakingParameters.parameters.bond_denom" /> @@ -80,7 +80,7 @@ export default { `filters`, `allTransactions`, `wallet`, - `bondingDenom`, + `stakingParameters`, `delegation`, `delegates`, `connected`, diff --git a/app/src/renderer/connectors/lcdClientMock.js b/app/src/renderer/connectors/lcdClientMock.js index e020a1f18a..9b5bff220a 100644 --- a/app/src/renderer/connectors/lcdClientMock.js +++ b/app/src/renderer/connectors/lcdClientMock.js @@ -302,9 +302,11 @@ let state = { bonded_tokens: `50.0000000000` }, stakingParameters: { - unbonding_time: `259200000000000`, - max_validators: 100, - bond_denom: `STAKE` + parameters: { + unbonding_time: `259200000000000`, + max_validators: 100, + bond_denom: `STAKE` + } }, governanceParameters: { deposit: { @@ -1196,10 +1198,10 @@ module.exports = { let depositCoinAmt = proposal.total_deposit.find(coin => { return coin.denom === `STAKE` }).amount - // TODO: get min deposit amount from gov params - if (parseInt(depositCoinAmt) >= 10) { + + let minDepositCoin = state.governanceParameters.deposit.min_deposit[0] + if (parseInt(depositCoinAmt) >= parseInt(minDepositCoin.amount)) { proposal.proposal_status = `VotingPeriod` - // TODO: get voting time from gov params proposal.voting_start_time = Date.now() proposal.voting_end_time = moment(proposal.voting_start_time) .add(86400000, `ms`) diff --git a/app/src/renderer/vuex/getters.js b/app/src/renderer/vuex/getters.js index 416d0d9886..fc055f074e 100644 --- a/app/src/renderer/vuex/getters.js +++ b/app/src/renderer/vuex/getters.js @@ -2,9 +2,6 @@ import BN from "bignumber.js" import { calculateTokens } from "scripts/common" // ui export const config = state => state.config -export const bondingDenom = state => - state.config.bondingDenom.charAt(0).toUpperCase() + - state.config.bondingDenom.slice(1) export const filters = state => state.filters export const notifications = state => state.notifications diff --git a/app/src/renderer/vuex/modules/config.js b/app/src/renderer/vuex/modules/config.js index f5bd85934d..5297f9d78a 100644 --- a/app/src/renderer/vuex/modules/config.js +++ b/app/src/renderer/vuex/modules/config.js @@ -11,8 +11,6 @@ export default () => { process.env.PREVIEW !== undefined ? JSON.parse(process.env.PREVIEW) : process.env.NODE_ENV === `development`, - // TODO: change to atom - bondingDenom: `STAKE`, modals: { error: { active: false }, help: { active: false }, diff --git a/app/src/renderer/vuex/modules/delegation.js b/app/src/renderer/vuex/modules/delegation.js index 1621cd41c8..8cb1153d5d 100644 --- a/app/src/renderer/vuex/modules/delegation.js +++ b/app/src/renderer/vuex/modules/delegation.js @@ -161,14 +161,14 @@ export default ({ node }) => { }, async submitDelegation( { - rootState: { config, user, wallet }, + rootState: { stakingParameters, user, wallet }, state, dispatch, commit }, { stakingTransactions, password } ) { - const denom = config.bondingDenom + const denom = stakingParameters.parameters.bond_denom const delegatorAddr = wallet.address // delegations = [], unbondings = [], redelegations = [] diff --git a/app/src/renderer/vuex/modules/wallet.js b/app/src/renderer/vuex/modules/wallet.js index b3887c0628..723f4d1d36 100644 --- a/app/src/renderer/vuex/modules/wallet.js +++ b/app/src/renderer/vuex/modules/wallet.js @@ -71,7 +71,9 @@ export default ({ node }) => { commit(`setAccountNumber`, res.account_number) commit(`setWalletBalances`, coins) for (let coin of coins) { - if (coin.denom === rootState.config.bondingDenom) { + if ( + coin.denom === rootState.stakingParameters.parameters.bond_denom + ) { commit(`setAtoms`, parseFloat(coin.amount)) break } diff --git a/test/unit/specs/components/staking/DelegationModal.spec.js b/test/unit/specs/components/staking/DelegationModal.spec.js index 6df814d851..8e50bb7de4 100644 --- a/test/unit/specs/components/staking/DelegationModal.spec.js +++ b/test/unit/specs/components/staking/DelegationModal.spec.js @@ -3,6 +3,7 @@ import setup from "../../../helpers/vuex-setup" import DelegationModal from "staking/DelegationModal" import Vuelidate from "vuelidate" +import lcdClientMock from "renderer/connectors/lcdClientMock.js" describe(`DelegationModal`, () => { let wrapper @@ -38,7 +39,7 @@ describe(`DelegationModal`, () => { mocks: { $store: { getters: { - bondingDenom: `atom` + stakingParameters: lcdClientMock.state.stakingParameters } } } diff --git a/test/unit/specs/components/staking/PageValidator.spec.js b/test/unit/specs/components/staking/PageValidator.spec.js index 168847063f..c532d05166 100644 --- a/test/unit/specs/components/staking/PageValidator.spec.js +++ b/test/unit/specs/components/staking/PageValidator.spec.js @@ -61,11 +61,8 @@ const validatorTo = { } const getterValues = { - bondingDenom: `atom`, - config: { - bondingDenom: `atom`, - desktop: false - }, + stakingParameters: lcdClientMock.state.stakingParameters, + config: { desktop: false }, delegates: { delegates: [validator, validatorTo], globalPower: 4200 @@ -503,7 +500,7 @@ describe(`onDelegation`, () => { `notify`, { body: `You have successfully delegated your ${ - getterValues.bondingDenom + getterValues.stakingParameters.parameters.bond_denom }s`, title: `Successful delegation!` } @@ -556,7 +553,9 @@ describe(`onDelegation`, () => { `notifyError`, { body: `message`, - title: `Error while delegating ${getterValues.bondingDenom}s` + title: `Error while delegating ${ + getterValues.stakingParameters.parameters.bond_denom + }s` } ] ]) @@ -607,7 +606,9 @@ describe(`onDelegation`, () => { `notifyError`, { body: `unexpected error`, - title: `Error while delegating ${getterValues.bondingDenom}s` + title: `Error while delegating ${ + getterValues.stakingParameters.parameters.bond_denom + }s` } ] ]) @@ -717,7 +718,7 @@ describe(`onDelegation`, () => { `notify`, { body: `You have successfully delegated your ${ - getterValues.bondingDenom + getterValues.stakingParameters.parameters.bond_denom }s`, title: `Successful delegation!` } @@ -772,7 +773,7 @@ describe(`onDelegation`, () => { { title: `Successful redelegation!`, body: `You have successfully redelegated your ${ - getterValues.bondingDenom + getterValues.stakingParameters.parameters.bond_denom }s` } ] @@ -823,7 +824,9 @@ describe(`onDelegation`, () => { [ `notifyError`, { - title: `Error while redelegating ${getterValues.bondingDenom}s`, + title: `Error while redelegating ${ + getterValues.stakingParameters.parameters.bond_denom + }s`, body: `message` } ] @@ -875,7 +878,9 @@ describe(`onDelegation`, () => { `notifyError`, { body: `unexpected error`, - title: `Error while redelegating ${getterValues.bondingDenom}s` + title: `Error while redelegating ${ + getterValues.stakingParameters.parameters.bond_denom + }s` } ] ]) diff --git a/test/unit/specs/components/staking/TabMyDelegations.spec.js b/test/unit/specs/components/staking/TabMyDelegations.spec.js index a0bcec3bb9..57ef583ed0 100644 --- a/test/unit/specs/components/staking/TabMyDelegations.spec.js +++ b/test/unit/specs/components/staking/TabMyDelegations.spec.js @@ -23,7 +23,7 @@ describe(`Component: TabMyDelegations`, () => { }, loaded: true }), - bondingDenom: () => `stake`, + stakingParameters: () => lcdClientMock.state.stakingParameters, connected: () => true } }) @@ -45,7 +45,7 @@ describe(`Component: TabMyDelegations`, () => { }, loaded: true }), - bondingDenom: () => `stake`, + stakingParameters: () => lcdClientMock.state.stakingParameters, connected: () => true } }) @@ -64,7 +64,7 @@ describe(`Component: TabMyDelegations`, () => { delegation: () => ({ unbondingDelegations: {} }), - bondingDenom: () => `stake`, + stakingParameters: () => lcdClientMock.state.stakingParameters, connected: () => true } }) @@ -84,7 +84,7 @@ describe(`Component: TabMyDelegations`, () => { unbondingDelegations: {}, loaded: false }), - bondingDenom: () => `stake`, + stakingParameters: () => lcdClientMock.state.stakingParameters, connected: () => false }, stubs: { @@ -107,7 +107,7 @@ describe(`Component: TabMyDelegations`, () => { loaded: true, loading: true }), - bondingDenom: () => `stake`, + stakingParameters: () => lcdClientMock.state.stakingParameters, connected: () => false }, stubs: { diff --git a/test/unit/specs/components/staking/UndelegationModal.spec.js b/test/unit/specs/components/staking/UndelegationModal.spec.js index f3e9104d7a..08f115b09a 100644 --- a/test/unit/specs/components/staking/UndelegationModal.spec.js +++ b/test/unit/specs/components/staking/UndelegationModal.spec.js @@ -3,6 +3,7 @@ import setup from "../../../helpers/vuex-setup" import UndelegationModal from "staking/UndelegationModal" import Vuelidate from "vuelidate" +import lcdClientMock from "renderer/connectors/lcdClientMock.js" describe(`UndelegationModal`, () => { let wrapper @@ -19,7 +20,7 @@ describe(`UndelegationModal`, () => { mocks: { $store: { getters: { - bondingDenom: `atom` + stakingParameters: lcdClientMock.state.stakingParameters } } } diff --git a/test/unit/specs/components/staking/__snapshots__/TabMyDelegations.spec.js.snap b/test/unit/specs/components/staking/__snapshots__/TabMyDelegations.spec.js.snap index df007a3f33..aeeb6437af 100644 --- a/test/unit/specs/components/staking/__snapshots__/TabMyDelegations.spec.js.snap +++ b/test/unit/specs/components/staking/__snapshots__/TabMyDelegations.spec.js.snap @@ -31,7 +31,7 @@ exports[`Component: TabMyDelegations should show a message if not staked yet to >
- Looks like you haven't delegated any stakes yet. Head over + Looks like you haven't delegated any STAKEs yet. Head over to the - Delegated stake + Delegated STAKE
- 100 + 100 - 20 + 20
- 0 + 0 - 0 + 0
- 0 + 0 - 0 + 0
- 10 + 10 - 56 + 56
- #1 + #2 - 500 + 0 - 25 + 0 - - 10 - + 0 - - 56 - + 0
- 100 + 100 - 20 + 20
- 0 + 0 - 0 + 0
- 0 + 0 - 0 + 0
- 10 + 10 - 56 + 56
- - 10 - + 10 - - 56 - + 56
- Delegated stake + Delegated STAKE
- Looks like you haven't delegated any stakes yet. Head over + Looks like you haven't delegated any STAKEs yet. Head over to the - Delegated stake + Delegated STAKE
{ @@ -291,9 +289,7 @@ describe(`Module: Delegations`, () => { await delegationModule({}).actions.submitDelegation( { rootState: { - config: { - bondingDenom: `atom` - }, + stakingParameters: lcdClientMock.state.stakingParameters, user: { atoms: 1000 }, diff --git a/test/unit/specs/store/governance/votes.spec.js b/test/unit/specs/store/governance/votes.spec.js index 83fb0d7fc4..b100a702ad 100644 --- a/test/unit/specs/store/governance/votes.spec.js +++ b/test/unit/specs/store/governance/votes.spec.js @@ -1,6 +1,6 @@ import votesModule from "renderer/vuex/modules/governance/votes.js" import lcdClientMock from "renderer/connectors/lcdClientMock.js" -let { proposals, votes } = lcdClientMock.state +let { proposals, votes, stakingParameters } = lcdClientMock.state let addresses = lcdClientMock.addresses let mockRootState = { @@ -56,9 +56,7 @@ describe(`Module: Votes`, () => { jest.useFakeTimers() const rootState = { - config: { - bondingDenom: `stake` - }, + stakingParameters, wallet: { address: addresses[0] } From 6a855437d190ee08e9c5a81bb88946c3469eb956 Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Fri, 21 Dec 2018 11:45:34 -0300 Subject: [PATCH 46/99] fix most PageValidator tests --- .../components/staking/UndelegationModal.vue | 2 +- app/src/renderer/vuex/modules/user.js | 2 + .../components/staking/PageValidator.spec.js | 201 +++++++++--------- .../__snapshots__/PageValidator.spec.js.snap | 58 +++-- 4 files changed, 144 insertions(+), 119 deletions(-) diff --git a/app/src/renderer/components/staking/UndelegationModal.vue b/app/src/renderer/components/staking/UndelegationModal.vue index 24ddd427b7..dc099cfa48 100644 --- a/app/src/renderer/components/staking/UndelegationModal.vue +++ b/app/src/renderer/components/staking/UndelegationModal.vue @@ -20,7 +20,7 @@ > diff --git a/app/src/renderer/vuex/modules/user.js b/app/src/renderer/vuex/modules/user.js index 162ea728b2..1e8e48cf3c 100644 --- a/app/src/renderer/vuex/modules/user.js +++ b/app/src/renderer/vuex/modules/user.js @@ -114,6 +114,8 @@ export default ({ node }) => { commit(`setModalSession`, false) dispatch(`initializeWallet`, address) dispatch(`loadErrorCollection`, account) + await dispatch(`getStakingParameters`) + await dispatch(`getGovParameters`) }, signOut({ state, commit, dispatch }) { state.account = null diff --git a/test/unit/specs/components/staking/PageValidator.spec.js b/test/unit/specs/components/staking/PageValidator.spec.js index c532d05166..4e37c90127 100644 --- a/test/unit/specs/components/staking/PageValidator.spec.js +++ b/test/unit/specs/components/staking/PageValidator.spec.js @@ -9,8 +9,12 @@ import { createLocalVue, mount } from "@vue/test-utils" import Vuelidate from "vuelidate" import BigNumber from "bignumber.js" +let { validators } = lcdClientMock +let { stakingParameters } = lcdClientMock.state +let { bond_denom } = lcdClientMock.state.stakingParameters.parameters + const validator = { - operator_address: lcdClientMock.validators[0], + operator_address: validators[0], pub_key: `cosmoschiapudding123456789`, tokens: `19`, delegator_shares: `19`, @@ -68,11 +72,11 @@ const getterValues = { globalPower: 4200 }, delegation: { - committedDelegates: { [lcdClientMock.validators[0]]: 0 }, + committedDelegates: { [validators[0]]: 0 }, unbondingDelegations: {} }, committedDelegations: { - [lcdClientMock.validators[0]]: 0 + [validators[0]]: 0 }, keybase: `keybase`, oldBondedAtoms: 50, @@ -93,13 +97,18 @@ describe(`PageValidator`, () => { let instance = mount(PageValidator, { localVue, doBefore: ({ router, store }) => { - router.push(`/staking/validators/${lcdClientMock.validators[0]}`) + router.push(`/staking/validators/${validators[0]}`) store.commit(`setCommittedDelegation`, { - candidateId: lcdClientMock.validators[0], + candidateId: validators[0], value: `123.45678` }) store.commit(`setConnected`, true) store.commit(`setDelegates`, [validator, validatorTo]) + }, + $store: { + commit: jest.fn(), + dispatch: jest.fn(), + getters: getterValues } }) wrapper = instance.wrapper @@ -111,35 +120,25 @@ describe(`PageValidator`, () => { // the perfect scroll plugin needs a $nextTick and a wrapper.update // to work properly in the tests (snapshots weren't matching) // this has occured across multiple tests + store.state.stakingParameters = stakingParameters await wrapper.vm.$nextTick() wrapper.update() expect(wrapper.vm.$el).toMatchSnapshot() }) it(`should return one delegate based on route params`, () => { - expect(wrapper.vm.validator.operator_address).toEqual( - lcdClientMock.validators[0] - ) + expect(wrapper.vm.validator.operator_address).toEqual(validators[0]) }) it(`shows a default avatar`, () => { + store.state.stakingParameters = stakingParameters + wrapper.update() expect(wrapper.vm.$el).toMatchSnapshot() }) it(`shows an error if the validator couldn't be found`, () => { - let instance = mount(PageValidator, { - doBefore: ({ router }) => { - router.push(`/staking/validators/${lcdClientMock.validators[0]}`) - }, - getters: { - config: () => ({ desktop: false }), - delegates: () => ({ - delegates: [] - }) - } - }) - - wrapper = instance.wrapper + store.state.delegates.delegates = [] + wrapper.update() expect(wrapper.vm.$el).toMatchSnapshot() }) @@ -147,7 +146,7 @@ describe(`PageValidator`, () => { it(`shows the selfBond`, async () => { await store.commit(`setSelfBond`, { validator: { - operator_address: lcdClientMock.validators[0], + operator_address: validators[0], delegator_shares: `4242` }, ratio: 0.01 @@ -326,11 +325,11 @@ describe(`delegationTargetOptions`, () => { getters: { ...getterValues, committedDelegations: { - [lcdClientMock.validators[0]]: 10 + [validators[0]]: 10 }, delegation: { committedDelegates: { - [lcdClientMock.validators[0]]: 10 + [validators[0]]: 10 }, unbondingDelegations: {} } @@ -365,12 +364,12 @@ describe(`delegationTargetOptions`, () => { getters: { ...getterValues, committedDelegations: { - [lcdClientMock.validators[0]]: 10, + [validators[0]]: 10, cosmosvaladdr15ky9du8a2wlstz6fpx3p4mqpjyrm5ctplpn3au: 5 }, delegation: { committedDelegates: { - [lcdClientMock.validators[0]]: 10, + [validators[0]]: 10, cosmosvaladdr15ky9du8a2wlstz6fpx3p4mqpjyrm5ctplpn3au: 5 }, unbondingDelegations: {} @@ -418,7 +417,7 @@ describe(`onDelegation`, () => { const wrapper = mount(PageValidator, { localVue, mocks: { - $route: { params: { validator: lcdClientMock.validators[0] } }, + $route: { params: { validator: validators[0] } }, $store } }) @@ -436,7 +435,7 @@ describe(`onDelegation`, () => { const wrapper = mount(PageValidator, { mocks: { - $route: { params: { validator: lcdClientMock.validators[0] } }, + $route: { params: { validator: validators[0] } }, $store } }) @@ -471,7 +470,7 @@ describe(`onDelegation`, () => { mocks: { $route: { params: { - validator: lcdClientMock.validators[0], + validator: validators[0], delegator_shares: `19` } }, @@ -488,20 +487,19 @@ describe(`onDelegation`, () => { await submitDelegation({ amount: 10, - from: `cosmos15ky9du8a2wlstz6fpx3p4mqpjyrm5ctpesxxn9` + from: `cosmos15ky9du8a2wlstz6fpx3p4mqpjyrm5ctpesxxn9`, + password: `12345` }) expect($store.dispatch.mock.calls).toEqual([ - [`submitDelegation`, { stakingTransactions }] + [`submitDelegation`, { stakingTransactions, password: `12345` }] ]) expect($store.commit.mock.calls).toEqual([ [ `notify`, { - body: `You have successfully delegated your ${ - getterValues.stakingParameters.parameters.bond_denom - }s`, + body: `You have successfully delegated your ${bond_denom}s`, title: `Successful delegation!` } ] @@ -521,7 +519,7 @@ describe(`onDelegation`, () => { mocks: { $route: { params: { - validator: lcdClientMock.validators[0], + validator: validators[0], delegator_shares: `19` } }, @@ -541,11 +539,12 @@ describe(`onDelegation`, () => { await submitDelegation({ amount: 10, - from: `cosmos15ky9du8a2wlstz6fpx3p4mqpjyrm5ctpesxxn9` + from: `cosmos15ky9du8a2wlstz6fpx3p4mqpjyrm5ctpesxxn9`, + password: `12345` }) expect($store.dispatch.mock.calls).toEqual([ - [`submitDelegation`, { stakingTransactions }] + [`submitDelegation`, { stakingTransactions, password: `12345` }] ]) expect($store.commit.mock.calls).toEqual([ @@ -553,9 +552,7 @@ describe(`onDelegation`, () => { `notifyError`, { body: `message`, - title: `Error while delegating ${ - getterValues.stakingParameters.parameters.bond_denom - }s` + title: `Error while delegating ${bond_denom}s` } ] ]) @@ -574,7 +571,7 @@ describe(`onDelegation`, () => { mocks: { $route: { params: { - validator: lcdClientMock.validators[0], + validator: validators[0], delegator_shares: `19` } }, @@ -594,11 +591,12 @@ describe(`onDelegation`, () => { await submitDelegation({ amount: 10, - from: `cosmos15ky9du8a2wlstz6fpx3p4mqpjyrm5ctpesxxn9` + from: `cosmos15ky9du8a2wlstz6fpx3p4mqpjyrm5ctpesxxn9`, + password: `12345` }) expect($store.dispatch.mock.calls).toEqual([ - [`submitDelegation`, { stakingTransactions }] + [`submitDelegation`, { stakingTransactions, password: `12345` }] ]) expect($store.commit.mock.calls).toEqual([ @@ -606,9 +604,7 @@ describe(`onDelegation`, () => { `notifyError`, { body: `unexpected error`, - title: `Error while delegating ${ - getterValues.stakingParameters.parameters.bond_denom - }s` + title: `Error while delegating ${bond_denom}s` } ] ]) @@ -631,7 +627,7 @@ describe(`onDelegation`, () => { getters: getterValues, rootState: getterValues, state: { - committedDelegates: { [lcdClientMock.validators[0]]: 0 }, + committedDelegates: { [validators[0]]: 0 }, unbondingDelegations: {} } } @@ -640,7 +636,7 @@ describe(`onDelegation`, () => { vm: { submitDelegation } } = mount(PageValidator, { mocks: { - $route: { params: { validator: lcdClientMock.validators[0] } }, + $route: { params: { validator: validators[0] } }, $store } }) @@ -649,7 +645,8 @@ describe(`onDelegation`, () => { await submitDelegation({ amount: 10, - from: `cosmos15ky9du8a2wlstz6fpx3p4mqpjyrm5ctpesxxn9` + from: `cosmos15ky9du8a2wlstz6fpx3p4mqpjyrm5ctpesxxn9`, + password: `12345` }) expect($store.dispatch.mock.calls).toEqual([ @@ -677,9 +674,9 @@ describe(`onDelegation`, () => { website: `www.schmidt.de` }, selfBond: 0.01, - id: lcdClientMock.validators[0], + id: validators[0], keybase: undefined, - operator_address: lcdClientMock.validators[0], + operator_address: validators[0], percent_of_vote: `65.52%`, prev_bonded_shares: `0`, proposer_reward_pool: null, @@ -691,7 +688,8 @@ describe(`onDelegation`, () => { } } ] - } + }, + password: `12345` } ], [ @@ -701,12 +699,13 @@ describe(`onDelegation`, () => { begin_redelegates: undefined, delegations: [ { - delegation: { amount: `10`, denom: `atom` }, + delegation: { amount: `10`, denom: bond_denom }, delegator_addr: `cosmos15ky9du8a2wlstz6fpx3p4mqpjyrm5ctpesxxn9`, - validator_addr: lcdClientMock.validators[0] + validator_addr: validators[0] } ], to: `cosmos15ky9du8a2wlstz6fpx3p4mqpjyrm5ctpesxxn9`, + password: `12345`, type: `updateDelegations` } ] @@ -717,9 +716,7 @@ describe(`onDelegation`, () => { [ `notify`, { - body: `You have successfully delegated your ${ - getterValues.stakingParameters.parameters.bond_denom - }s`, + body: `You have successfully delegated your ${bond_denom}s`, title: `Successful delegation!` } ] @@ -760,7 +757,7 @@ describe(`onDelegation`, () => { await submitDelegation({ amount: 5, - from: lcdClientMock.validators[0] + from: validators[0] }) expect($store.dispatch.mock.calls).toEqual([ @@ -772,9 +769,7 @@ describe(`onDelegation`, () => { `notify`, { title: `Successful redelegation!`, - body: `You have successfully redelegated your ${ - getterValues.stakingParameters.parameters.bond_denom - }s` + body: `You have successfully redelegated your ${bond_denom}s` } ] ]) @@ -813,20 +808,19 @@ describe(`onDelegation`, () => { await submitDelegation({ amount: 5, - from: lcdClientMock.validators[0] + from: validators[0], + password: `12345` }) expect($store.dispatch.mock.calls).toEqual([ - [`submitDelegation`, { stakingTransactions }] + [`submitDelegation`, { stakingTransactions, password: `12345` }] ]) expect($store.commit.mock.calls).toEqual([ [ `notifyError`, { - title: `Error while redelegating ${ - getterValues.stakingParameters.parameters.bond_denom - }s`, + title: `Error while redelegating ${bond_denom}s`, body: `message` } ] @@ -866,11 +860,12 @@ describe(`onDelegation`, () => { await submitDelegation({ amount: 5, - from: lcdClientMock.validators[0] + from: validators[0], + password: `12345` }) expect($store.dispatch.mock.calls).toEqual([ - [`submitDelegation`, { stakingTransactions }] + [`submitDelegation`, { stakingTransactions, password: `12345` }] ]) expect($store.commit.mock.calls).toEqual([ @@ -878,9 +873,7 @@ describe(`onDelegation`, () => { `notifyError`, { body: `unexpected error`, - title: `Error while redelegating ${ - getterValues.stakingParameters.parameters.bond_denom - }s` + title: `Error while redelegating ${bond_denom}s` } ] ]) @@ -903,7 +896,7 @@ describe(`onDelegation`, () => { getters: getterValues, rootState: getterValues, state: { - committedDelegates: { [lcdClientMock.validators[0]]: 10 }, + committedDelegates: { [validators[0]]: 10 }, unbondingDelegations: {} } } @@ -925,7 +918,8 @@ describe(`onDelegation`, () => { await submitDelegation({ amount: 5, - from: lcdClientMock.validators[0] + from: validators[0], + password: `12345` }) expect($store.dispatch.mock.calls).toEqual([ @@ -940,7 +934,8 @@ describe(`onDelegation`, () => { validatorDst: validatorTo } ] - } + }, + password: `12345` } ], [ @@ -951,12 +946,13 @@ describe(`onDelegation`, () => { begin_redelegates: [ { delegator_addr: `cosmos15ky9du8a2wlstz6fpx3p4mqpjyrm5ctpesxxn9`, - validator_src_addr: lcdClientMock.validators[0], + validator_src_addr: validators[0], validator_dst_addr: `cosmosvaladdr15ky9du8a2wlstz6fpx3p4mqpjyrm5ctplpn3au`, shares: `50000000000.0000000000` } ], to: `cosmos15ky9du8a2wlstz6fpx3p4mqpjyrm5ctpesxxn9`, + password: `12345`, type: `updateDelegations` } ] @@ -967,7 +963,7 @@ describe(`onDelegation`, () => { `notify`, { title: `Successful redelegation!`, - body: `You have successfully redelegated your atoms` + body: `You have successfully redelegated your ${bond_denom}s` } ] ]) @@ -987,14 +983,14 @@ describe(`onUnstake`, () => { commit: jest.fn(), dispatch: jest.fn(), getters: Object.assign({}, getterValues, { - committedDelegations: { [lcdClientMock.validators[0]]: 10 } + committedDelegations: { [validators[0]]: 10 } }) } const wrapper = mount(PageValidator, { localVue, mocks: { - $route: { params: { validator: lcdClientMock.validators[0] } }, + $route: { params: { validator: validators[0] } }, $store } }) @@ -1017,7 +1013,7 @@ describe(`onUnstake`, () => { const wrapper = mount(PageValidator, { localVue, mocks: { - $route: { params: { validator: lcdClientMock.validators[0] } }, + $route: { params: { validator: validators[0] } }, $store } }) @@ -1047,19 +1043,22 @@ describe(`onUnstake`, () => { vm: { submitUndelegation } } = mount(PageValidator, { mocks: { - $route: { params: { validator: lcdClientMock.validators[0] } }, + $route: { params: { validator: validators[0] } }, $store } }) $store.dispatch.mockClear() - await submitUndelegation({ amount: 10 }) + await submitUndelegation({ amount: 10, password: `12345` }) expect($store.dispatch.mock.calls).toEqual([ [ `submitDelegation`, - { stakingTransactions: { unbondings: [{ atoms: -10, validator }] } } + { + stakingTransactions: { unbondings: [{ atoms: -10, validator }] }, + password: `12345` + } ] ]) @@ -1067,7 +1066,7 @@ describe(`onUnstake`, () => { [ `notify`, { - body: `You have successfully undelegated 10 atoms.`, + body: `You have successfully undelegated 10 ${bond_denom}s.`, title: `Successful Undelegation!` } ] @@ -1085,7 +1084,7 @@ describe(`onUnstake`, () => { vm: { submitUndelegation } } = mount(PageValidator, { mocks: { - $route: { params: { validator: lcdClientMock.validators[0] } }, + $route: { params: { validator: validators[0] } }, $store } }) @@ -1095,12 +1094,15 @@ describe(`onUnstake`, () => { throw new Error(`message`) }) - await submitUndelegation({ amount: 10 }) + await submitUndelegation({ amount: 10, password: `12345` }) expect($store.dispatch.mock.calls).toEqual([ [ `submitDelegation`, - { stakingTransactions: { unbondings: [{ atoms: -10, validator }] } } + { + stakingTransactions: { unbondings: [{ atoms: -10, validator }] }, + password: `12345` + } ] ]) @@ -1109,7 +1111,7 @@ describe(`onUnstake`, () => { `notifyError`, { body: `message`, - title: `Error while undelegating atoms` + title: `Error while undelegating ${bond_denom}s` } ] ]) @@ -1126,7 +1128,7 @@ describe(`onUnstake`, () => { vm: { submitUndelegation } } = mount(PageValidator, { mocks: { - $route: { params: { validator: lcdClientMock.validators[0] } }, + $route: { params: { validator: validators[0] } }, $store } }) @@ -1136,13 +1138,14 @@ describe(`onUnstake`, () => { throw new Error(`unexpected error`) }) - await submitUndelegation({ amount: 10 }) + await submitUndelegation({ amount: 10, password: `12345` }) expect($store.dispatch.mock.calls).toEqual([ [ `submitDelegation`, { - stakingTransactions: { unbondings: [{ atoms: -10, validator }] } + stakingTransactions: { unbondings: [{ atoms: -10, validator }] }, + password: `12345` } ] ]) @@ -1152,7 +1155,7 @@ describe(`onUnstake`, () => { `notifyError`, { body: `unexpected error`, - title: `Error while undelegating atoms` + title: `Error while undelegating ${bond_denom}s` } ] ]) @@ -1160,7 +1163,7 @@ describe(`onUnstake`, () => { }) describe(`composition`, () => { - it(`delegation.submitDelegation`, async () => { + it(`undelegation.submitDelegation`, async () => { const delegation = Delegation({}) const dispatch = jest.fn((type, payload) => { @@ -1175,7 +1178,7 @@ describe(`onUnstake`, () => { getters: getterValues, rootState: getterValues, state: { - committedDelegates: { [lcdClientMock.validators[0]]: 10 }, + committedDelegates: { [validators[0]]: 10 }, unbondingDelegations: {} } } @@ -1184,14 +1187,14 @@ describe(`onUnstake`, () => { vm: { submitUndelegation } } = mount(PageValidator, { mocks: { - $route: { params: { validator: lcdClientMock.validators[0] } }, + $route: { params: { validator: validators[0] } }, $store } }) $store.dispatch.mockClear() - await submitUndelegation({ amount: 10 }) + await submitUndelegation({ amount: 10, password: `12345` }) expect($store.dispatch.mock.calls).toEqual([ [ @@ -1204,7 +1207,8 @@ describe(`onUnstake`, () => { validator } ] - } + }, + password: `12345` } ], [ @@ -1214,11 +1218,12 @@ describe(`onUnstake`, () => { { delegator_addr: `cosmos15ky9du8a2wlstz6fpx3p4mqpjyrm5ctpesxxn9`, shares: `10.0000000000`, - validator_addr: lcdClientMock.validators[0] + validator_addr: validators[0] } ], delegations: undefined, to: `cosmos15ky9du8a2wlstz6fpx3p4mqpjyrm5ctpesxxn9`, + password: `12345`, type: `updateDelegations` } ] @@ -1228,7 +1233,7 @@ describe(`onUnstake`, () => { [ `notify`, { - body: `You have successfully undelegated 10 atoms.`, + body: `You have successfully undelegated 10 ${bond_denom}s.`, title: `Successful Undelegation!` } ] diff --git a/test/unit/specs/components/staking/__snapshots__/PageValidator.spec.js.snap b/test/unit/specs/components/staking/__snapshots__/PageValidator.spec.js.snap index 09bf95403d..64048436f8 100644 --- a/test/unit/specs/components/staking/__snapshots__/PageValidator.spec.js.snap +++ b/test/unit/specs/components/staking/__snapshots__/PageValidator.spec.js.snap @@ -464,7 +464,9 @@ exports[`PageValidator has the expected html structure 1`] = ` class="info_dl" >
+ Self Delegated STAKE +
- Minimum Self Delegated STAKE + + Minimum Self Delegated + STAKE +
@@ -962,7 +967,9 @@ exports[`PageValidator shows a default avatar 1`] = ` class="info_dl" >
+ Self Delegated STAKE +
- Minimum Self Delegated STAKE + + Minimum Self Delegated + STAKE +
@@ -1254,7 +1264,7 @@ exports[`onDelegation make sure we have enough atoms to delegate is not enough 1 class="total-atoms top-section" >

- Total atom + Total STAKE

- Available atom + Available STAKE

@@ -1457,7 +1467,7 @@ exports[`onDelegation make sure we have enough atoms to delegate is not enough 1 class="colored_dl" >
- Delegated atom + Delegated STAKE
@@ -1635,7 +1645,9 @@ exports[`onDelegation make sure we have enough atoms to delegate is not enough 1 class="info_dl" >
- Self Delegated atom + + Self Delegated STAKE +
- You have no atoms + You have no STAKEs to delegate. @@ -1765,7 +1777,7 @@ exports[`onDelegation make sure we have enough atoms to delegate is not enough 2 class="total-atoms top-section" >

- Total atom + Total STAKE

- Available atom + Available STAKE

@@ -1968,7 +1980,7 @@ exports[`onDelegation make sure we have enough atoms to delegate is not enough 2 class="colored_dl" >
- Delegated atom + Delegated STAKE
@@ -2146,7 +2158,9 @@ exports[`onDelegation make sure we have enough atoms to delegate is not enough 2 class="info_dl" >
- Self Delegated atom + + Self Delegated STAKE +

- Total atom + Total STAKE

- Available atom + Available STAKE

@@ -2411,7 +2425,7 @@ exports[`onUnstake make sure there are enough atoms to unstake is not enough 1`] class="colored_dl" >
- Delegated atom + Delegated STAKE
@@ -2589,7 +2603,9 @@ exports[`onUnstake make sure there are enough atoms to unstake is not enough 1`] class="info_dl" >
- Self Delegated atom + + Self Delegated STAKE +
- You have no atoms + You have no STAKEs delegated to this validator. @@ -2719,7 +2735,7 @@ exports[`onUnstake make sure there are enough atoms to unstake is not enough 2`] class="total-atoms top-section" >

- Total atom + Total STAKE

- Available atom + Available STAKE

@@ -2922,7 +2938,7 @@ exports[`onUnstake make sure there are enough atoms to unstake is not enough 2`] class="colored_dl" >
- Delegated atom + Delegated STAKE
@@ -3100,7 +3116,9 @@ exports[`onUnstake make sure there are enough atoms to unstake is not enough 2`] class="info_dl" >
- Self Delegated atom + + Self Delegated STAKE +
Date: Fri, 21 Dec 2018 12:52:34 -0300 Subject: [PATCH 47/99] more tests --- app/src/renderer/vuex/modules/parameters.js | 1 - app/src/renderer/vuex/modules/user.js | 4 ++-- .../components/staking/PageValidator.spec.js | 5 ++--- .../components/staking/TabParameters.spec.js | 19 +++++++++---------- .../components/staking/TabValidators.spec.js | 10 ++++++++-- .../staking/TableValidators.spec.js | 11 +++++++---- .../TabMyDelegations.spec.js.snap | 8 ++++---- .../__snapshots__/TabParameters.spec.js.snap | 4 ++-- .../components/wallet/PageWallet.spec.js | 9 +++++++-- 9 files changed, 41 insertions(+), 30 deletions(-) diff --git a/app/src/renderer/vuex/modules/parameters.js b/app/src/renderer/vuex/modules/parameters.js index 1aa543ea77..610c2d168c 100644 --- a/app/src/renderer/vuex/modules/parameters.js +++ b/app/src/renderer/vuex/modules/parameters.js @@ -28,7 +28,6 @@ export default ({ node }) => { try { let parameters = await node.getStakingParameters() - state.error = null commit(`setStakingParameters`, parameters) state.error = null state.loading = false diff --git a/app/src/renderer/vuex/modules/user.js b/app/src/renderer/vuex/modules/user.js index 1e8e48cf3c..cef227522f 100644 --- a/app/src/renderer/vuex/modules/user.js +++ b/app/src/renderer/vuex/modules/user.js @@ -114,8 +114,8 @@ export default ({ node }) => { commit(`setModalSession`, false) dispatch(`initializeWallet`, address) dispatch(`loadErrorCollection`, account) - await dispatch(`getStakingParameters`) - await dispatch(`getGovParameters`) + dispatch(`getStakingParameters`) + dispatch(`getGovParameters`) }, signOut({ state, commit, dispatch }) { state.account = null diff --git a/test/unit/specs/components/staking/PageValidator.spec.js b/test/unit/specs/components/staking/PageValidator.spec.js index 4e37c90127..561815075f 100644 --- a/test/unit/specs/components/staking/PageValidator.spec.js +++ b/test/unit/specs/components/staking/PageValidator.spec.js @@ -113,6 +113,8 @@ describe(`PageValidator`, () => { }) wrapper = instance.wrapper store = instance.store + store.state.stakingParameters = stakingParameters + wrapper.update() }) it(`has the expected html structure`, async () => { @@ -120,7 +122,6 @@ describe(`PageValidator`, () => { // the perfect scroll plugin needs a $nextTick and a wrapper.update // to work properly in the tests (snapshots weren't matching) // this has occured across multiple tests - store.state.stakingParameters = stakingParameters await wrapper.vm.$nextTick() wrapper.update() expect(wrapper.vm.$el).toMatchSnapshot() @@ -131,8 +132,6 @@ describe(`PageValidator`, () => { }) it(`shows a default avatar`, () => { - store.state.stakingParameters = stakingParameters - wrapper.update() expect(wrapper.vm.$el).toMatchSnapshot() }) diff --git a/test/unit/specs/components/staking/TabParameters.spec.js b/test/unit/specs/components/staking/TabParameters.spec.js index 4a477d400b..3848d0b8fd 100644 --- a/test/unit/specs/components/staking/TabParameters.spec.js +++ b/test/unit/specs/components/staking/TabParameters.spec.js @@ -17,7 +17,7 @@ describe(`TabParameters`, () => { doBefore: ({ store }) => { store.commit(`setConnected`, true) store.commit(`setPool`, pool) - store.commit(`setStakingParameters`, stakingParameters) + store.commit(`setStakingParameters`, stakingParameters.parameters) }, stubs: { "tm-data-connecting": ``, @@ -26,14 +26,13 @@ describe(`TabParameters`, () => { }) wrapper = instance.wrapper store = instance.store - store.state.stakingParameters.parameters.loaded = true + store.state.stakingParameters = stakingParameters + store.state.stakingParameters.loaded = true store.state.pool.loaded = true wrapper.update() }) it(`has the expected html structure`, async () => { - await wrapper.vm.$nextTick() - wrapper.update() expect(htmlBeautify(wrapper.html())).toMatchSnapshot() }) @@ -48,12 +47,12 @@ describe(`TabParameters`, () => { it(`displays a message if waiting for connection`, () => { store.commit(`setConnected`, false) - store.state.stakingParameters.parameters.loaded = false + store.state.stakingParameters.loaded = false wrapper.update() expect(wrapper.vm.$el).toMatchSnapshot() expect(wrapper.exists(`tm-data-connecting`)).toBe(true) - store.state.stakingParameters.parameters.loaded = true + store.state.stakingParameters.loaded = true store.state.pool.loaded = false wrapper.update() expect(wrapper.vm.$el).toMatchSnapshot() @@ -62,14 +61,14 @@ describe(`TabParameters`, () => { it(`displays a message if loading`, () => { store.commit(`setConnected`, true) - store.state.stakingParameters.parameters.loaded = false - store.state.stakingParameters.parameters.loading = true + store.state.stakingParameters.loaded = false + store.state.stakingParameters.loading = true wrapper.update() expect(wrapper.vm.$el).toMatchSnapshot() expect(wrapper.exists(`tm-data-loading`)).toBe(true) - store.state.stakingParameters.parameters.loaded = true - store.state.stakingParameters.parameters.loading = false + store.state.stakingParameters.loaded = true + store.state.stakingParameters.loading = false store.state.pool.loaded = false store.state.pool.loading = true wrapper.update() diff --git a/test/unit/specs/components/staking/TabValidators.spec.js b/test/unit/specs/components/staking/TabValidators.spec.js index 7790b401f2..4f7f042064 100644 --- a/test/unit/specs/components/staking/TabValidators.spec.js +++ b/test/unit/specs/components/staking/TabValidators.spec.js @@ -1,6 +1,9 @@ import setup from "../../../helpers/vuex-setup" import htmlBeautify from "html-beautify" import TabValidators from "renderer/components/staking/TabValidators" +import lcdClientMock from "renderer/connectors/lcdClientMock.js" + +let { stakingParameters } = lcdClientMock.state describe(`TabValidators`, () => { let wrapper @@ -9,6 +12,9 @@ describe(`TabValidators`, () => { beforeEach(async () => { let instance = mount(TabValidators, { + doBefore: ({ store }) => { + store.commit(`setConnected`, true) + }, stubs: { "tm-data-connecting": ``, "tm-data-loading": ``, @@ -17,9 +23,9 @@ describe(`TabValidators`, () => { }) wrapper = instance.wrapper store = instance.store - - store.commit(`setConnected`, true) + store.state.stakingParameters = stakingParameters await store.dispatch(`getDelegates`) + wrapper.update() }) it(`has the expected html structure`, async () => { diff --git a/test/unit/specs/components/staking/TableValidators.spec.js b/test/unit/specs/components/staking/TableValidators.spec.js index 9a823a198a..dd79a72305 100644 --- a/test/unit/specs/components/staking/TableValidators.spec.js +++ b/test/unit/specs/components/staking/TableValidators.spec.js @@ -3,21 +3,24 @@ import htmlBeautify from "html-beautify" import TableValidators from "renderer/components/staking/TableValidators" import lcdClientMock from "renderer/connectors/lcdClientMock.js" +let { stakingParameters } = lcdClientMock.state + describe(`TableValidators`, () => { let wrapper, store let { mount } = setup() beforeEach(() => { let instance = mount(TableValidators, { + doBefore: ({ store }) => { + store.commit(`setConnected`, true) + store.commit(`setAtoms`, 1337) + }, propsData: { validators: lcdClientMock.candidates } }) - wrapper = instance.wrapper store = instance.store - - store.commit(`setConnected`, true) store.state.user.address = `address1234` - store.commit(`setAtoms`, 1337) + store.state.stakingParameters = stakingParameters wrapper.update() }) diff --git a/test/unit/specs/components/staking/__snapshots__/TabMyDelegations.spec.js.snap b/test/unit/specs/components/staking/__snapshots__/TabMyDelegations.spec.js.snap index aeeb6437af..3b937568ff 100644 --- a/test/unit/specs/components/staking/__snapshots__/TabMyDelegations.spec.js.snap +++ b/test/unit/specs/components/staking/__snapshots__/TabMyDelegations.spec.js.snap @@ -31,8 +31,8 @@ exports[`Component: TabMyDelegations should show a message if not staked yet to >
- Looks like you haven't delegated any STAKEs yet. Head over - to the + Looks like you haven't delegated any + STAKEs yet. Head over to the
- Looks like you haven't delegated any STAKEs yet. Head over - to the + Looks like you haven't delegated any + STAKEs yet. Head over to the
- Loose STAKE info_outline + Loose STAKE info_outline
100.0000000000 @@ -29,7 +29,7 @@ exports[`TabParameters has the expected html structure 1`] = `
- Delegated STAKE info_outline + Delegated STAKE info_outline
50.0000000000 diff --git a/test/unit/specs/components/wallet/PageWallet.spec.js b/test/unit/specs/components/wallet/PageWallet.spec.js index 347e0a9e15..7a0c807e7b 100644 --- a/test/unit/specs/components/wallet/PageWallet.spec.js +++ b/test/unit/specs/components/wallet/PageWallet.spec.js @@ -1,5 +1,9 @@ import setup from "../../../helpers/vuex-setup" import PageWallet from "renderer/components/wallet/PageWallet" +import lcdClientMock from "renderer/connectors/lcdClientMock.js" + +let { stakingParameters } = lcdClientMock.state + describe(`PageWallet`, () => { let wrapper, store let { mount } = setup() @@ -13,7 +17,8 @@ describe(`PageWallet`, () => { }, doBefore: ({ store }) => { store.commit(`setConnected`, true) - } + }, + $store: { getters: { stakingParameters } } }) wrapper = instance.wrapper store = instance.store @@ -23,7 +28,7 @@ describe(`PageWallet`, () => { password: `1234567890` }) store.commit(`setSearchQuery`, [`balances`, ``]) - + store.state.stakingParameters = stakingParameters wrapper.update() }) From 10df4d27225adc4178901b4260a2c62c48f053e4 Mon Sep 17 00:00:00 2001 From: Karoly Albert Szabo Date: Fri, 28 Dec 2018 11:48:56 +0100 Subject: [PATCH 48/99] fix label for MuyDelegation spec Signed-off-by: Karoly Albert Szabo --- .../staking/TabMyDelegations.spec.js | 2 +- .../TabMyDelegations.spec.js.snap | 680 ++---------------- 2 files changed, 51 insertions(+), 631 deletions(-) diff --git a/test/unit/specs/components/staking/TabMyDelegations.spec.js b/test/unit/specs/components/staking/TabMyDelegations.spec.js index cb1f791c4d..d320160b5b 100644 --- a/test/unit/specs/components/staking/TabMyDelegations.spec.js +++ b/test/unit/specs/components/staking/TabMyDelegations.spec.js @@ -51,7 +51,7 @@ describe(`Component: TabMyDelegations`, () => { } }) - expect(instance.wrapper.html()).toContain(`Unbonding validators`) + expect(instance.wrapper.html()).toContain(`Unbonding transactions`) expect(instance.wrapper.vm.$el).toMatchSnapshot() }) diff --git a/test/unit/specs/components/staking/__snapshots__/TabMyDelegations.spec.js.snap b/test/unit/specs/components/staking/__snapshots__/TabMyDelegations.spec.js.snap index fd9c28118e..4c714fde6e 100644 --- a/test/unit/specs/components/staking/__snapshots__/TabMyDelegations.spec.js.snap +++ b/test/unit/specs/components/staking/__snapshots__/TabMyDelegations.spec.js.snap @@ -51,8 +51,6 @@ exports[`Component: TabMyDelegations should show a message if not staked yet to - -
`; @@ -274,353 +272,64 @@ exports[`Component: TabMyDelegations should show committed validators 1`] = `

- Unbonding validators + Unbonding transactions + info_outline +

-
- + + +`; + +exports[`Component: TabMyDelegations should show unbonding validators 1`] = ` +
+ + +
+
+ -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Moniker - - - - Delegated stake - - - - Rewards - - - - Voting Power - - - - Uptime - - - - Commission - - - - Slashes - -
- - -
- - - - good_greg - - -
-
-
- - cosmosvaladdr…n3au - -
- -
- - check - - - Copied - -
-
-
-
-
- - 0.0000… - - - n/a - - - 0.00% - - - n/a - - 0.00% - - n/a -
- - -
- - - - herr_schmidt_revoked - - -
-
-
- - cosmosvaladdr…rg7n - -
- -
- - check - - - Copied - -
-
-
-
-
- - 0.0000… - - - n/a - - - 0.00% - - - n/a - - 0.00% - - n/a -
-
-
- -
-

- - Unbonding transactions - - - - info_outline - - -

- -
-
-`; - -exports[`Component: TabMyDelegations should show unbonding validators 1`] = ` -
- - -
-
- - info_outline - -
-
-
-
- No Active Delegations -
-
-
- +
+
+
+ No Active Delegations +
+
+
+
+ + Looks like you haven't delegated any stakes yet. Head over + to the + + validator list @@ -634,298 +343,6 @@ exports[`Component: TabMyDelegations should show unbonding validators 1`] = ` -
-

- - Unbonding validators - - - info_outline - -

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Moniker - - - - Delegated stake - - - - Rewards - - - - Voting Power - - - - Uptime - - - - Commission - - - - Slashes - -
- - -
- - - - good_greg - - -
-
-
- - cosmosvaladdr…n3au - -
- -
- - check - - - Copied - -
-
-
-
-
- - 0.0000… - - - n/a - - - 0.00% - - - n/a - - 0.00% - - n/a -
- - -
- - - - herr_schmidt_revoked - - -
-
-
- - cosmosvaladdr…rg7n - -
- -
- - check - - - Copied - -
-
-
-
-
- - 0.0000… - - - n/a - - - 0.00% - - - n/a - - 0.00% - - n/a -
-
-
-

+
`; From 7e1c392a2ac502a33fdd041f53b7610af4cb690b Mon Sep 17 00:00:00 2001 From: Fabian Date: Wed, 2 Jan 2019 15:36:30 +0100 Subject: [PATCH 49/99] Fabo/1432 reintegrate tendermint/UI (#1759) * imported components * readded converters * converted pug * fixed styles before converting * fixed more * fixed more * fixed more * fixed more * fixed some issue in stylus converter * fixed imports * fixed several * added ligov * some fixes * fixed several * fixed several * fixed * fixed some more * a lot working * fixed page validator tests * fixed tabparameters tests * fixed some * fixed page transactions * fixed some * fixed onboarding * fixed more * fixed some more * at wallet.js * some pagevalidator * refactored vuex setup * fixed page validator tests * fixed vuex refactor * moved conversion scripts * linted * changelog * fixed som property issues * several snapshot updates * fixed wallet module tests * fixed several * restructured * updated jest * fixed last tests * fixed missing balance updates * cosmetics * fixed e2e tests * fixed tests * removed htmlbeautifier * removed converters * added several tests from tm/ui * fixed tests regarding transactions * more coverage * fixed more snapshots * some more coverage * improved timeout on e2e test * added tmnotiication tests * added more coverage * added coverage for tmfield * updated snaphsot * increased coverage * increased coverage on tmlistake * increased coverage on tmlibank * added coverage for tmfield * fixed merge conflicts * increased coverage on tmfield * increased coverage for tmlistake * missing snaoshot * Update test/unit/specs/components/wallet/PageWallet.spec.js Co-Authored-By: faboweb * added PR comments * fixed transaction times * updated tests * spread notification props * fixed snapshot * removd old test utils * removed couple of $nextTick * refactored some tests --- CHANGELOG.md | 1 + app/src/renderer/App.vue | 2 +- .../renderer/components/common/AppHeader.vue | 8 +- .../renderer/components/common/AppMenu.vue | 2 +- .../renderer/components/common/Page404.vue | 4 +- .../components/common/PagePreferences.vue | 8 +- .../components/common/PageProfile.vue | 2 +- .../components/common/TmBarDiscrete.vue | 106 ++ app/src/renderer/components/common/TmBtn.vue | 249 ++++ .../renderer/components/common/TmBtnCopy.vue | 6 +- .../components/common/TmBtnReceive.vue | 2 +- .../components/common/TmDataConnecting.vue | 2 +- .../components/common/TmDataEmpty.vue | 27 + .../components/common/TmDataEmptySearch.vue | 2 +- .../components/common/TmDataEmptyTx.vue | 2 +- .../components/common/TmDataError.vue | 2 +- .../components/common/TmDataLoading.vue | 25 + .../renderer/components/common/TmDataMsg.vue | 91 ++ .../renderer/components/common/TmField.vue | 510 +++++++ .../components/common/TmFieldGroup.vue | 35 + .../components/common/TmFieldSeed.vue | 2 +- .../components/common/TmFormGroup.vue | 109 ++ .../renderer/components/common/TmFormMsg.vue | 136 ++ .../components/common/TmFormStruct.vue | 119 ++ .../components/common/TmHardwareState.vue | 2 +- .../renderer/components/common/TmListItem.vue | 469 +++++++ .../renderer/components/common/TmModal.vue | 4 +- .../components/common/TmModalError.vue | 2 +- .../components/common/TmModalHelp.vue | 2 +- .../components/common/TmModalLCDApproval.vue | 3 +- .../components/common/TmModalNodeHalted.vue | 2 +- .../components/common/TmModalSearch.vue | 68 +- .../components/common/TmNotification.vue | 191 +++ .../components/common/TmNotifications.vue | 62 + .../components/common/TmOnboarding.vue | 26 +- app/src/renderer/components/common/TmPage.vue | 76 ++ .../components/common/TmPageFooter.vue | 23 + .../components/common/TmPageHeader.vue | 90 ++ app/src/renderer/components/common/TmPart.vue | 2 +- .../common/TmSessionAccountDelete.vue | 12 +- .../components/common/TmSessionHardware.vue | 2 +- .../components/common/TmSessionImport.vue | 12 +- .../components/common/TmSessionSignIn.vue | 12 +- .../components/common/TmSessionSignUp.vue | 12 +- .../renderer/components/common/TmUserPane.vue | 2 +- .../components/governance/ModalDeposit.vue | 5 +- .../components/governance/ModalPropose.vue | 14 +- .../components/governance/ModalVote.vue | 5 +- .../components/governance/PageGovernance.vue | 5 +- .../components/governance/PageProposal.vue | 11 +- .../components/governance/TabParameters.vue | 8 +- .../components/governance/TabProposals.vue | 3 +- .../components/staking/DelegationModal.vue | 5 +- .../components/staking/PageStaking.vue | 2 +- .../components/staking/PageValidator.vue | 17 +- .../components/staking/TabMyDelegations.vue | 3 +- .../components/staking/TabParameters.vue | 13 +- .../components/staking/TabValidators.vue | 3 +- .../components/staking/UndelegationModal.vue | 5 +- .../transactions/TmLiAnyTransaction.vue | 101 ++ .../transactions/TmLiBankTransaction.vue | 179 +++ .../transactions/TmLiGovTransaction.vue | 176 +++ .../transactions/TmLiStakeTransaction.vue | 251 ++++ .../transactions/TmLiTransaction.vue | 146 ++ .../transactions/transaction-colors.js | 15 + app/src/renderer/components/wallet/LiCoin.vue | 4 +- .../renderer/components/wallet/PageSend.vue | 27 +- .../components/wallet/PageTransactions.vue | 22 +- .../renderer/components/wallet/PageWallet.vue | 21 +- .../wallet/TmModalSendConfirmation.vue | 3 +- app/src/renderer/styles/variables.styl | 55 - app/src/renderer/vuex/getters.js | 5 +- app/src/renderer/vuex/modules/blockchain.js | 2 +- .../renderer/vuex/modules/notifications.js | 3 +- app/src/renderer/vuex/modules/transactions.js | 5 +- app/src/renderer/vuex/modules/wallet.js | 8 +- jest.config.js | 9 +- package.json | 16 +- tasks/watch.sh | 2 +- test/e2e/delegation.js | 3 +- test/e2e/wallet.js | 17 +- test/unit/helpers/electron_mock.js | 3 + test/unit/helpers/fixed_time.js | 2 +- test/unit/helpers/mock_perfect-scrollbar.js | 1 + test/unit/helpers/vuex-setup.js | 67 +- test/unit/helpers/window_mock.js | 2 + test/unit/specs/App.spec.js | 9 +- .../specs/components/common/AppHeader.spec.js | 20 +- .../specs/components/common/AppMenu.spec.js | 5 +- .../common/FundraiserWarning.spec.js | 7 +- .../specs/components/common/Page404.spec.js | 7 - .../components/common/PagePreferences.spec.js | 7 - .../components/common/ShortBech32.spec.js | 7 +- .../specs/components/common/TmBalance.spec.js | 4 +- .../components/common/TmBarDiscrete.spec.js | 34 + .../specs/components/common/TmBtn.spec.js | 54 + .../common/TmConnectedNetwork.spec.js | 19 +- .../common/TmDataConnecting.spec.js | 3 +- .../components/common/TmDataEmpty.spec.js | 40 + .../common/TmDataEmptySearch.spec.js | 3 +- .../components/common/TmDataEmptyTx.spec.js | 9 +- .../components/common/TmDataError.spec.js | 3 +- .../components/common/TmDataLoading.spec.js | 31 + .../specs/components/common/TmDataMsg.spec.js | 48 + .../specs/components/common/TmField.spec.js | 161 +++ .../components/common/TmFieldAddon.spec.js | 3 +- .../components/common/TmFieldGroup.spec.js | 20 + .../components/common/TmFieldSeed.spec.js | 3 +- .../components/common/TmFormGroup.spec.js | 40 + .../specs/components/common/TmFormMsg.spec.js | 115 ++ .../components/common/TmFormStruct.spec.js | 68 + .../components/common/TmHardwareState.spec.js | 3 +- .../components/common/TmLiSession.spec.js | 4 +- .../components/common/TmListItem.spec.js | 121 ++ .../specs/components/common/TmModal.spec.js | 7 +- .../components/common/TmModalError.spec.js | 8 +- .../components/common/TmModalHelp.spec.js | 2 - .../components/common/TmModalReceive.spec.js | 1 - .../components/common/TmModalSearch.spec.js | 16 +- .../components/common/TmNotification.spec.js | 68 + .../components/common/TmNotifications.spec.js | 25 + .../components/common/TmOnboarding.spec.js | 16 +- .../specs/components/common/TmSession.spec.js | 35 +- .../common/TmSessionAccountDelete.spec.js | 22 +- .../common/TmSessionHardware.spec.js | 8 +- .../components/common/TmSessionImport.spec.js | 5 +- .../common/TmSessionLoading.spec.js | 5 +- .../components/common/TmSessionSignIn.spec.js | 13 +- .../components/common/TmSessionSignUp.spec.js | 4 +- .../common/TmSessionWelcome.spec.js | 8 +- .../components/common/TmUserPane.spec.js | 11 +- .../specs/components/common/ToolBar.spec.js | 41 +- .../__snapshots__/AppHeader.spec.js.snap | 152 ++- .../common/__snapshots__/AppMenu.spec.js.snap | 164 ++- .../FundraiserWarning.spec.js.snap | 30 +- .../common/__snapshots__/Page404.spec.js.snap | 48 +- .../PagePreferences.spec.js.snap | 62 +- .../__snapshots__/PageProfile.spec.js.snap | 3 + .../__snapshots__/TextBlock.spec.js.snap | 1 + .../__snapshots__/TmBalance.spec.js.snap | 103 +- .../__snapshots__/TmBarDiscrete.spec.js.snap | 22 + .../common/__snapshots__/TmBtn.spec.js.snap | 114 ++ .../__snapshots__/TmBtnCopy.spec.js.snap | 2 +- .../__snapshots__/TmBtnReceive.spec.js.snap | 2 +- .../TmConnectedNetwork.spec.js.snap | 52 +- .../TmDataConnecting.spec.js.snap | 47 +- .../__snapshots__/TmDataEmpty.spec.js.snap | 37 + .../TmDataEmptySearch.spec.js.snap | 44 +- .../__snapshots__/TmDataEmptyTx.spec.js.snap | 58 +- .../__snapshots__/TmDataError.spec.js.snap | 55 +- .../__snapshots__/TmDataLoading.spec.js.snap | 32 + .../__snapshots__/TmDataMsg.spec.js.snap | 33 + .../common/__snapshots__/TmField.spec.js.snap | 255 ++++ .../__snapshots__/TmFieldAddon.spec.js.snap | 14 +- .../__snapshots__/TmFieldGroup.spec.js.snap | 12 + .../__snapshots__/TmFieldSeed.spec.js.snap | 7 +- .../__snapshots__/TmFormGroup.spec.js.snap | 24 + .../__snapshots__/TmFormMsg.spec.js.snap | 10 + .../__snapshots__/TmFormStruct.spec.js.snap | 54 + .../TmHardwareState.spec.js.snap | 21 +- .../__snapshots__/TmLiCopy.spec.js.snap | 2 - .../__snapshots__/TmListItem.spec.js.snap | 437 ++++++ .../__snapshots__/TmModalError.spec.js.snap | 92 +- .../TmModalLCDApproval.spec.js.snap | 2 - .../TmModalNodeHalted.spec.js.snap | 2 - .../__snapshots__/TmModalSearch.spec.js.snap | 2 +- .../__snapshots__/TmNotification.spec.js.snap | 205 +++ .../TmNotifications.spec.js.snap | 66 + .../__snapshots__/TmOnboarding.spec.js.snap | 770 ++++++++--- .../TmSessionAccountDelete.spec.js.snap | 192 ++- .../TmSessionHardware.spec.js.snap | 79 +- .../TmSessionImport.spec.js.snap | 292 ++-- .../TmSessionLoading.spec.js.snap | 49 +- .../TmSessionSignIn.spec.js.snap | 205 ++- .../TmSessionSignUp.spec.js.snap | 346 +++-- .../TmSessionWelcome.spec.js.snap | 478 +++++-- .../__snapshots__/TmUserPane.spec.js.snap | 9 +- .../common/__snapshots__/ToolBar.spec.js.snap | 47 +- .../components/governance/LiProposal.spec.js | 19 +- .../governance/ModalDeposit.spec.js | 5 +- .../governance/ModalPropose.spec.js | 26 +- .../components/governance/ModalVote.spec.js | 5 +- .../governance/PageGovernance.spec.js | 16 +- .../governance/PageProposal.spec.js | 38 +- .../governance/TabParameters.spec.js | 8 +- .../governance/TabProposals.spec.js | 97 +- .../governance/TableProposals.spec.js | 11 +- .../__snapshots__/LiProposal.spec.js.snap | 6 +- .../__snapshots__/ModalDeposit.spec.js.snap | 3 +- .../__snapshots__/ModalPropose.spec.js.snap | 11 +- .../__snapshots__/ModalVote.spec.js.snap | 8 +- .../__snapshots__/PageGovernance.spec.js.snap | 681 ++++++---- .../__snapshots__/PageProposal.spec.js.snap | 137 +- .../__snapshots__/TabParameters.spec.js.snap | 298 +++-- .../__snapshots__/TabProposals.spec.js.snap | 481 +++++-- .../__snapshots__/TableProposals.spec.js.snap | 435 ++++-- .../staking/DelegationModal.spec.js | 5 +- .../components/staking/LiValidator.spec.js | 133 +- .../components/staking/PageStaking.spec.js | 11 +- .../components/staking/PageValidator.spec.js | 1030 ++++---------- .../staking/TabMyDelegations.spec.js | 4 +- .../components/staking/TabParameters.spec.js | 43 +- .../components/staking/TabValidators.spec.js | 24 +- .../staking/TableValidators.spec.js | 11 +- .../staking/UndelegationModal.spec.js | 5 +- .../DelegationModal.spec.js.snap | 8 +- .../__snapshots__/LiValidator.spec.js.snap | 8 +- .../__snapshots__/PageStaking.spec.js.snap | 339 +++-- .../__snapshots__/PageValidator.spec.js.snap | 1186 +++++++++++++---- .../TabMyDelegations.spec.js.snap | 55 +- .../__snapshots__/TabParameters.spec.js.snap | 238 +++- .../__snapshots__/TabValidators.spec.js.snap | 984 ++++++++++---- .../TableValidators.spec.js.snap | 512 +++++-- .../UndelegationModal.spec.js.snap | 5 +- .../transactions/TmLiAnyTransaction.spec.js | 41 + .../transactions/TmLiBankTransaction.spec.js | 42 + .../transactions/TmLiGovTransaction.spec.js | 33 + .../transactions/TmLiStakeTransaction.spec.js | 75 ++ .../transactions/TmLiTransaction.spec.js | 25 + .../TmLiAnyTransaction.spec.js.snap | 181 +++ .../TmLiBankTransaction.spec.js.snap | 81 ++ .../TmLiGovTransaction.spec.js.snap | 141 ++ .../TmLiStakeTransaction.spec.js.snap | 355 +++++ .../TmLiTransaction.spec.js.snap | 56 + .../specs/components/wallet/LiCoin.spec.js | 1 - .../specs/components/wallet/PageSend.spec.js | 45 +- .../wallet/PageTransactions.spec.js | 68 +- .../components/wallet/PageWallet.spec.js | 42 +- .../wallet/__snapshots__/LiCoin.spec.js.snap | 10 +- .../__snapshots__/PageSend.spec.js.snap | 335 +++-- .../PageTransactions.spec.js.snap | 168 +-- .../__snapshots__/PageWallet.spec.js.snap | 111 +- .../TmModalSendConfirmation.spec.js.snap | 4 - .../__snapshots__/lcdClientMock.spec.js.snap | 0 .../specs/{ => connectors}/lcdClient.spec.js | 2 +- .../{ => connectors}/lcdClientMock.spec.js | 0 test/unit/specs/{ => connectors}/node.spec.js | 0 .../specs/{ => connectors}/rpcWrapper.spec.js | 0 .../{ => connectors}/rpcWrapperMock.spec.js | 0 .../__snapshots__/notification.spec.js.snap | 6 + .../__snapshots__/transactions.spec.js.snap | 360 ++++- test/unit/specs/store/json/txs.js | 370 ++++- test/unit/specs/store/notification.spec.js | 2 + test/unit/specs/store/wallet.spec.js | 264 ++-- webpack.renderer.config.js | 6 +- yarn.lock | 1093 +++++++++------ 246 files changed, 15431 insertions(+), 5018 deletions(-) create mode 100644 app/src/renderer/components/common/TmBarDiscrete.vue create mode 100644 app/src/renderer/components/common/TmBtn.vue create mode 100644 app/src/renderer/components/common/TmDataEmpty.vue create mode 100644 app/src/renderer/components/common/TmDataLoading.vue create mode 100644 app/src/renderer/components/common/TmDataMsg.vue create mode 100644 app/src/renderer/components/common/TmField.vue create mode 100644 app/src/renderer/components/common/TmFieldGroup.vue create mode 100644 app/src/renderer/components/common/TmFormGroup.vue create mode 100644 app/src/renderer/components/common/TmFormMsg.vue create mode 100644 app/src/renderer/components/common/TmFormStruct.vue create mode 100644 app/src/renderer/components/common/TmListItem.vue create mode 100644 app/src/renderer/components/common/TmNotification.vue create mode 100644 app/src/renderer/components/common/TmNotifications.vue create mode 100644 app/src/renderer/components/common/TmPage.vue create mode 100644 app/src/renderer/components/common/TmPageFooter.vue create mode 100644 app/src/renderer/components/common/TmPageHeader.vue create mode 100644 app/src/renderer/components/transactions/TmLiAnyTransaction.vue create mode 100644 app/src/renderer/components/transactions/TmLiBankTransaction.vue create mode 100644 app/src/renderer/components/transactions/TmLiGovTransaction.vue create mode 100644 app/src/renderer/components/transactions/TmLiStakeTransaction.vue create mode 100644 app/src/renderer/components/transactions/TmLiTransaction.vue create mode 100644 app/src/renderer/components/transactions/transaction-colors.js delete mode 100644 app/src/renderer/styles/variables.styl create mode 100644 test/unit/helpers/mock_perfect-scrollbar.js create mode 100644 test/unit/helpers/window_mock.js create mode 100644 test/unit/specs/components/common/TmBarDiscrete.spec.js create mode 100644 test/unit/specs/components/common/TmBtn.spec.js create mode 100644 test/unit/specs/components/common/TmDataEmpty.spec.js create mode 100644 test/unit/specs/components/common/TmDataLoading.spec.js create mode 100644 test/unit/specs/components/common/TmDataMsg.spec.js create mode 100644 test/unit/specs/components/common/TmField.spec.js create mode 100644 test/unit/specs/components/common/TmFieldGroup.spec.js create mode 100644 test/unit/specs/components/common/TmFormGroup.spec.js create mode 100644 test/unit/specs/components/common/TmFormMsg.spec.js create mode 100644 test/unit/specs/components/common/TmFormStruct.spec.js create mode 100644 test/unit/specs/components/common/TmListItem.spec.js create mode 100644 test/unit/specs/components/common/TmNotification.spec.js create mode 100644 test/unit/specs/components/common/TmNotifications.spec.js create mode 100644 test/unit/specs/components/common/__snapshots__/TmBarDiscrete.spec.js.snap create mode 100644 test/unit/specs/components/common/__snapshots__/TmBtn.spec.js.snap create mode 100644 test/unit/specs/components/common/__snapshots__/TmDataEmpty.spec.js.snap create mode 100644 test/unit/specs/components/common/__snapshots__/TmDataLoading.spec.js.snap create mode 100644 test/unit/specs/components/common/__snapshots__/TmDataMsg.spec.js.snap create mode 100644 test/unit/specs/components/common/__snapshots__/TmField.spec.js.snap create mode 100644 test/unit/specs/components/common/__snapshots__/TmFieldGroup.spec.js.snap create mode 100644 test/unit/specs/components/common/__snapshots__/TmFormGroup.spec.js.snap create mode 100644 test/unit/specs/components/common/__snapshots__/TmFormMsg.spec.js.snap create mode 100644 test/unit/specs/components/common/__snapshots__/TmFormStruct.spec.js.snap create mode 100644 test/unit/specs/components/common/__snapshots__/TmListItem.spec.js.snap create mode 100644 test/unit/specs/components/common/__snapshots__/TmNotification.spec.js.snap create mode 100644 test/unit/specs/components/common/__snapshots__/TmNotifications.spec.js.snap create mode 100644 test/unit/specs/components/transactions/TmLiAnyTransaction.spec.js create mode 100644 test/unit/specs/components/transactions/TmLiBankTransaction.spec.js create mode 100644 test/unit/specs/components/transactions/TmLiGovTransaction.spec.js create mode 100644 test/unit/specs/components/transactions/TmLiStakeTransaction.spec.js create mode 100644 test/unit/specs/components/transactions/TmLiTransaction.spec.js create mode 100644 test/unit/specs/components/transactions/__snapshots__/TmLiAnyTransaction.spec.js.snap create mode 100644 test/unit/specs/components/transactions/__snapshots__/TmLiBankTransaction.spec.js.snap create mode 100644 test/unit/specs/components/transactions/__snapshots__/TmLiGovTransaction.spec.js.snap create mode 100644 test/unit/specs/components/transactions/__snapshots__/TmLiStakeTransaction.spec.js.snap create mode 100644 test/unit/specs/components/transactions/__snapshots__/TmLiTransaction.spec.js.snap rename test/unit/specs/{ => connectors}/__snapshots__/lcdClientMock.spec.js.snap (100%) rename test/unit/specs/{ => connectors}/lcdClient.spec.js (99%) rename test/unit/specs/{ => connectors}/lcdClientMock.spec.js (100%) rename test/unit/specs/{ => connectors}/node.spec.js (100%) rename test/unit/specs/{ => connectors}/rpcWrapper.spec.js (100%) rename test/unit/specs/{ => connectors}/rpcWrapperMock.spec.js (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index b23fa76077..6b235f6f42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -88,6 +88,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - [\#1626](https://github.com/cosmos/voyager/issues/1626) upgraded from raven to sentry/browser @jbibla - [\#1724](https://github.com/cosmos/voyager/issues/1724) set tabindex attribute to -1 for readonly denom on ModalProposals. tab navgiation now skips element @enyan94 - [\#1277](https://github.com/cosmos/voyager/issues/1277) change name of VmToolBar to ToolBar, update all snapshots and import statements @coreycosman +- [\#1432](https://github.com/cosmos/voyager/issues/1432) Moved @tendermint/UI components back into the Voyager repository @faboweb ### Fixed diff --git a/app/src/renderer/App.vue b/app/src/renderer/App.vue index 2cd22488ae..4fc3a87318 100644 --- a/app/src/renderer/App.vue +++ b/app/src/renderer/App.vue @@ -21,7 +21,7 @@ + + diff --git a/app/src/renderer/components/common/TmBtn.vue b/app/src/renderer/components/common/TmBtn.vue new file mode 100644 index 0000000000..cc394f626a --- /dev/null +++ b/app/src/renderer/components/common/TmBtn.vue @@ -0,0 +1,249 @@ + + + + + diff --git a/app/src/renderer/components/common/TmBtnCopy.vue b/app/src/renderer/components/common/TmBtnCopy.vue index 74ae0f3951..ce8bedeaab 100644 --- a/app/src/renderer/components/common/TmBtnCopy.vue +++ b/app/src/renderer/components/common/TmBtnCopy.vue @@ -9,17 +9,17 @@ diff --git a/app/src/renderer/components/common/TmDataEmptySearch.vue b/app/src/renderer/components/common/TmDataEmptySearch.vue index 93d6af5571..9ddb66af6f 100644 --- a/app/src/renderer/components/common/TmDataEmptySearch.vue +++ b/app/src/renderer/components/common/TmDataEmptySearch.vue @@ -6,7 +6,7 @@ diff --git a/app/src/renderer/components/common/TmDataMsg.vue b/app/src/renderer/components/common/TmDataMsg.vue new file mode 100644 index 0000000000..0cecaafa38 --- /dev/null +++ b/app/src/renderer/components/common/TmDataMsg.vue @@ -0,0 +1,91 @@ + + + + + diff --git a/app/src/renderer/components/common/TmField.vue b/app/src/renderer/components/common/TmField.vue new file mode 100644 index 0000000000..e337e0f34e --- /dev/null +++ b/app/src/renderer/components/common/TmField.vue @@ -0,0 +1,510 @@ + + + + + diff --git a/app/src/renderer/components/common/TmFieldGroup.vue b/app/src/renderer/components/common/TmFieldGroup.vue new file mode 100644 index 0000000000..505e969741 --- /dev/null +++ b/app/src/renderer/components/common/TmFieldGroup.vue @@ -0,0 +1,35 @@ + + + + + diff --git a/app/src/renderer/components/common/TmFieldSeed.vue b/app/src/renderer/components/common/TmFieldSeed.vue index 471fd80f93..35bcfbf3df 100644 --- a/app/src/renderer/components/common/TmFieldSeed.vue +++ b/app/src/renderer/components/common/TmFieldSeed.vue @@ -9,7 +9,7 @@ + + diff --git a/app/src/renderer/components/common/TmFormMsg.vue b/app/src/renderer/components/common/TmFormMsg.vue new file mode 100644 index 0000000000..ee6ba82adb --- /dev/null +++ b/app/src/renderer/components/common/TmFormMsg.vue @@ -0,0 +1,136 @@ + + + + + diff --git a/app/src/renderer/components/common/TmFormStruct.vue b/app/src/renderer/components/common/TmFormStruct.vue new file mode 100644 index 0000000000..9ed1c5481d --- /dev/null +++ b/app/src/renderer/components/common/TmFormStruct.vue @@ -0,0 +1,119 @@ + + + + + diff --git a/app/src/renderer/components/common/TmHardwareState.vue b/app/src/renderer/components/common/TmHardwareState.vue index 25601549cc..1fe16a2cd7 100644 --- a/app/src/renderer/components/common/TmHardwareState.vue +++ b/app/src/renderer/components/common/TmHardwareState.vue @@ -16,7 +16,7 @@ export default { }, spin: { type: Boolean, - required: true + default: false }, value: { type: String, diff --git a/app/src/renderer/components/common/TmListItem.vue b/app/src/renderer/components/common/TmListItem.vue new file mode 100644 index 0000000000..12b25a90b5 --- /dev/null +++ b/app/src/renderer/components/common/TmListItem.vue @@ -0,0 +1,469 @@ + + + + + diff --git a/app/src/renderer/components/common/TmModal.vue b/app/src/renderer/components/common/TmModal.vue index ffddc10b20..89f8296e32 100644 --- a/app/src/renderer/components/common/TmModal.vue +++ b/app/src/renderer/components/common/TmModal.vue @@ -24,11 +24,11 @@ export default { props: { icon: { type: String, - required: true + default: null }, size: { type: String, - required: true + default: null }, close: { type: Function, diff --git a/app/src/renderer/components/common/TmModalError.vue b/app/src/renderer/components/common/TmModalError.vue index b2beef08ea..6b98e2d9f4 100644 --- a/app/src/renderer/components/common/TmModalError.vue +++ b/app/src/renderer/components/common/TmModalError.vue @@ -31,7 +31,7 @@ diff --git a/app/src/renderer/components/common/TmNotification.vue b/app/src/renderer/components/common/TmNotification.vue new file mode 100644 index 0000000000..a03ff08086 --- /dev/null +++ b/app/src/renderer/components/common/TmNotification.vue @@ -0,0 +1,191 @@ + + + + + diff --git a/app/src/renderer/components/common/TmNotifications.vue b/app/src/renderer/components/common/TmNotifications.vue new file mode 100644 index 0000000000..950aeeb976 --- /dev/null +++ b/app/src/renderer/components/common/TmNotifications.vue @@ -0,0 +1,62 @@ + + + + + diff --git a/app/src/renderer/components/common/TmOnboarding.vue b/app/src/renderer/components/common/TmOnboarding.vue index 74eda0b1d9..c75e5d43db 100644 --- a/app/src/renderer/components/common/TmOnboarding.vue +++ b/app/src/renderer/components/common/TmOnboarding.vue @@ -9,7 +9,11 @@
{{ activeValue }}
- +

@@ -189,6 +190,7 @@ exports[`PageTransactions has the expected html structure 1`] = ` bondingdenom="STAKE" proposalsurl="/governance/proposals" transaction="[object Object]" + unbondingtime="NaN" validators="" validatorsurl="/staking/validators" /> @@ -197,6 +199,7 @@ exports[`PageTransactions has the expected html structure 1`] = ` bondingdenom="STAKE" proposalsurl="/governance/proposals" transaction="[object Object]" + unbondingtime="NaN" validators="" validatorsurl="/staking/validators" /> @@ -205,6 +208,7 @@ exports[`PageTransactions has the expected html structure 1`] = ` bondingdenom="STAKE" proposalsurl="/governance/proposals" transaction="[object Object]" + unbondingtime="NaN" validators="" validatorsurl="/staking/validators" /> @@ -213,6 +217,7 @@ exports[`PageTransactions has the expected html structure 1`] = ` bondingdenom="STAKE" proposalsurl="/governance/proposals" transaction="[object Object]" + unbondingtime="NaN" validators="" validatorsurl="/staking/validators" /> @@ -221,6 +226,7 @@ exports[`PageTransactions has the expected html structure 1`] = ` bondingdenom="STAKE" proposalsurl="/governance/proposals" transaction="[object Object]" + unbondingtime="NaN" validators="" validatorsurl="/staking/validators" /> @@ -409,6 +415,7 @@ exports[`PageTransactions should filter the transactions 1`] = ` bondingdenom="STAKE" proposalsurl="/governance/proposals" transaction="[object Object]" + unbondingtime="NaN" validators="" validatorsurl="/staking/validators" /> diff --git a/test/unit/specs/scripts/time.spec.js b/test/unit/specs/scripts/time.spec.js new file mode 100644 index 0000000000..8847aa728b --- /dev/null +++ b/test/unit/specs/scripts/time.spec.js @@ -0,0 +1,45 @@ +import time from "renderer/scripts/time" +import lcdClientMock from "renderer/connectors/lcdClientMock.js" +const delegates = lcdClientMock.candidates +const transaction = lcdClientMock.state.txs[0] +const unbondingTransaction = lcdClientMock.state.txs[5] + +describe(`time helper`, () => { + describe(`getUnbondingTime`, () => { + it(`should return NaN with wrong transactions`, () => { + const address = delegates[0].operator_address + expect( + time.getUnbondingTime(transaction, { + [address]: { + creation_height: `170`, + min_time: new Date().toISOString() + } + }) + ).toBe(NaN) + }) + + it(`should return NaN for unbonding transactions when height does not match`, () => { + const address = delegates[0].operator_address + expect( + time.getUnbondingTime(unbondingTransaction, { + [address]: { + creation_height: `171`, + min_time: new Date().toISOString() + } + }) + ).toBe(NaN) + }) + + it(`should return time for unbonding transactions when height match`, () => { + const address = delegates[0].operator_address + expect( + time.getUnbondingTime(unbondingTransaction, { + [address]: { + creation_height: `170`, + min_time: new Date().toISOString() + } + }) + ).toBe(42000) + }) + }) +}) From 10e0e1482f613a704c0ff3f9c20ca8b0d2906cdb Mon Sep 17 00:00:00 2001 From: Federico Kunze <31522760+fedekunze@users.noreply.github.com> Date: Fri, 4 Jan 2019 10:25:45 -0300 Subject: [PATCH 83/99] address review comments --- test/unit/specs/components/common/TmConnectedNetwork.spec.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/unit/specs/components/common/TmConnectedNetwork.spec.js b/test/unit/specs/components/common/TmConnectedNetwork.spec.js index d5d8d93ee0..3c6441da51 100644 --- a/test/unit/specs/components/common/TmConnectedNetwork.spec.js +++ b/test/unit/specs/components/common/TmConnectedNetwork.spec.js @@ -6,7 +6,7 @@ describe(`TmConnectedNetwork`, () => { let { mount } = setup() beforeEach(async () => { - let instance = mount(TmConnectedNetwork, { + const instance = mount(TmConnectedNetwork, { getters: { lastHeader: () => ({ chain_id: `Test Net`, height: 42 }), nodeUrl: () => `https://faboNode.de`, @@ -19,7 +19,6 @@ describe(`TmConnectedNetwork`, () => { it(`has the expected html structure`, () => { expect(wrapper.vm.$el).toMatchSnapshot() - console.log(wrapper.vm.$el.outerHTML) }) it(`has a network icon`, () => { From 0add55668cf251339a60148fe376ce384b7e65db Mon Sep 17 00:00:00 2001 From: Jordan Bibla Date: Fri, 4 Jan 2019 10:12:31 -0500 Subject: [PATCH 84/99] Update CODEOWNERS (#1788) * refresh CODEOWNERS list --- CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CODEOWNERS b/CODEOWNERS index 6bf15d6b4c..c937e22e5b 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -5,4 +5,4 @@ # the repo. Unless a later match takes precedence, # @global-owner1 and @global-owner2 will be requested for # review when someone opens a pull request. -* @nylira @faboweb @NodeGuy +* @faboweb @jbibla @fedekunze @sabau From 97a2d980c4650a80e26c9a46128bad7474ef1c37 Mon Sep 17 00:00:00 2001 From: Fabian Date: Fri, 4 Jan 2019 17:39:27 +0100 Subject: [PATCH 85/99] Fabo/1791 fix voyager init (#1794) * Fixed a problem with initializing the Voyager config dir * fixed tests by adding copyFile to fs extra mock --- CHANGELOG.md | 1 + app/src/main/index.js | 13 ++++++++++++- test/unit/helpers/fs-mock.js | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90dffaf793..eeba2d44ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -142,6 +142,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - [\#1572](https://github.com/cosmos/voyager/issues/1572) Fixed scroll bug when switching between tabs @jbibla - [\#1749](https://github.com/cosmos/voyager/issues/1749) Fixed proposal tally update after voting @fedekunze - [\#1765](https://github.com/cosmos/voyager/pull/1765) Fixed proposal deposit update after submitting a deposit @fedekunze +- [\#1791](https://github.com/cosmos/voyager/pull/1791) Fixed a problem with initializing the Voyager config dir @faboweb ## [0.10.7] - 2018-10-10 diff --git a/app/src/main/index.js b/app/src/main/index.js index d56cf98bf9..fa4cba448c 100644 --- a/app/src/main/index.js +++ b/app/src/main/index.js @@ -656,7 +656,18 @@ async function main() { // copy predefined genesis.json and config.toml into root fs.accessSync(networkPath) // crash if invalid path - fs.copySync(networkPath, root) + await fs.copyFile( + join(networkPath, `config.toml`), + join(root, `config.toml`) + ) + await fs.copyFile( + join(networkPath, `gaiaversion.txt`), + join(root, `gaiaversion.txt`) + ) + await fs.copyFile( + join(networkPath, `genesis.json`), + join(root, `genesis.json`) + ) fs.writeFileSync(appVersionPath, pkgVersion) } diff --git a/test/unit/helpers/fs-mock.js b/test/unit/helpers/fs-mock.js index 1cc700694d..950ed0ee2e 100644 --- a/test/unit/helpers/fs-mock.js +++ b/test/unit/helpers/fs-mock.js @@ -15,6 +15,7 @@ export default function mockFsExtra(fileSystem = {}) { } create(to, fsExtraMock.fs, file) }, + copyFile: (from, to) => fsExtraMock.copy(from, to), ensureFile: path => { let { file } = get(path, fsExtraMock.fs) if (file === null) { From aa39b3b365d4cc565aa163d0deaee5611ae1117b Mon Sep 17 00:00:00 2001 From: Karoly Albert Szabo Date: Fri, 4 Jan 2019 19:27:02 +0100 Subject: [PATCH 86/99] change time format to 24h - change times to agree with fixed-time - fix transactions enrichment to match props expectations Signed-off-by: Karoly Albert Szabo --- CHANGELOG.md | 1 + .../components/transactions/TmLiTransaction.vue | 2 +- app/src/renderer/vuex/modules/transactions.js | 3 ++- .../__snapshots__/TmLiAnyTransaction.spec.js.snap | 6 +++--- .../__snapshots__/TmLiGovTransaction.spec.js.snap | 4 ++-- .../__snapshots__/TmLiStakeTransaction.spec.js.snap | 10 +++++----- .../__snapshots__/TmLiTransaction.spec.js.snap | 2 +- .../store/__snapshots__/transactions.spec.js.snap | 4 ++-- test/unit/specs/store/transactions.spec.js | 4 ++-- 9 files changed, 19 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eeba2d44ff..fd23b4b7f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -93,6 +93,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - [\#1432](https://github.com/cosmos/voyager/issues/1432) Moved @tendermint/UI components back into the Voyager repository @faboweb - Improved the readme @faboweb - [\#1792](https://github.com/cosmos/voyager/pull/1792) removed mocked demo mode @fedekunze +- [\#1720](https://github.com/cosmos/voyager/issues/1720) Time format from 12 to 24h @sabau ### Fixed diff --git a/app/src/renderer/components/transactions/TmLiTransaction.vue b/app/src/renderer/components/transactions/TmLiTransaction.vue index 45241fcc6c..85dd897cc9 100644 --- a/app/src/renderer/components/transactions/TmLiTransaction.vue +++ b/app/src/renderer/components/transactions/TmLiTransaction.vue @@ -47,7 +47,7 @@ export default { }, computed: { date() { - return moment(this.time).format(`h:mm a`) + return moment(this.time).format(`HH:mm`) } } } diff --git a/app/src/renderer/vuex/modules/transactions.js b/app/src/renderer/vuex/modules/transactions.js index 9a28b8dffd..52eab2641e 100644 --- a/app/src/renderer/vuex/modules/transactions.js +++ b/app/src/renderer/vuex/modules/transactions.js @@ -33,7 +33,8 @@ export default ({ node }) => { txCategories.forEach(category => { state[category].forEach(t => { if (t.height === blockHeight && blockMetaInfo) { - Vue.set(t, `time`, blockMetaInfo.header.time) + // time seems to be an ISO string, but we are expecting a Number type + Vue.set(t, `time`, new Date(blockMetaInfo.header.time).getTime()) } }) }) diff --git a/test/unit/specs/components/transactions/__snapshots__/TmLiAnyTransaction.spec.js.snap b/test/unit/specs/components/transactions/__snapshots__/TmLiAnyTransaction.spec.js.snap index b3fbdb5b79..0d7c7e6449 100644 --- a/test/unit/specs/components/transactions/__snapshots__/TmLiAnyTransaction.spec.js.snap +++ b/test/unit/specs/components/transactions/__snapshots__/TmLiAnyTransaction.spec.js.snap @@ -55,7 +55,7 @@ exports[`TmLiAnyTransaction shows bank transactions 1`] = ` > Block #3436  - @ 12:00 am + @ 00:00
@@ -123,7 +123,7 @@ exports[`TmLiAnyTransaction shows stake transactions 1`] = ` > Block #568  - @ 12:00 am + @ 00:00 @@ -173,7 +173,7 @@ exports[`TmLiAnyTransaction shows unknown transactions 1`] = ` > Block #3436  - @ 12:00 am + @ 00:00 diff --git a/test/unit/specs/components/transactions/__snapshots__/TmLiGovTransaction.spec.js.snap b/test/unit/specs/components/transactions/__snapshots__/TmLiGovTransaction.spec.js.snap index 53260a81ef..8ed7472bcf 100644 --- a/test/unit/specs/components/transactions/__snapshots__/TmLiGovTransaction.spec.js.snap +++ b/test/unit/specs/components/transactions/__snapshots__/TmLiGovTransaction.spec.js.snap @@ -66,7 +66,7 @@ exports[`TmLiGovTransaction deposits should show deposits 1`] = ` > Block #56675  - @ 12:00 am + @ 00:00 @@ -133,7 +133,7 @@ exports[`TmLiGovTransaction proposals should show proposals submission transacti > Block #56673  - @ 12:00 am + @ 00:00 diff --git a/test/unit/specs/components/transactions/__snapshots__/TmLiStakeTransaction.spec.js.snap b/test/unit/specs/components/transactions/__snapshots__/TmLiStakeTransaction.spec.js.snap index bccbb92424..65ea4624d4 100644 --- a/test/unit/specs/components/transactions/__snapshots__/TmLiStakeTransaction.spec.js.snap +++ b/test/unit/specs/components/transactions/__snapshots__/TmLiStakeTransaction.spec.js.snap @@ -61,7 +61,7 @@ exports[`TmLiStakeTransaction delegations should show delegations 1`] = ` > Block #568  - @ 12:00 am + @ 00:00 @@ -136,7 +136,7 @@ exports[`TmLiStakeTransaction redelegations should show redelegations and calcul > Block #567  - @ 12:00 am + @ 00:00 @@ -205,7 +205,7 @@ exports[`TmLiStakeTransaction unbonding delegations should default to ended if n > Block #569  - @ 12:00 am + @ 00:00 @@ -274,7 +274,7 @@ exports[`TmLiStakeTransaction unbonding delegations should show unbonding delega > Block #569  - @ 12:00 am + @ 00:00 @@ -347,7 +347,7 @@ exports[`TmLiStakeTransaction unbonding delegations should show unbondings and c > Block #569  - @ 12:00 am + @ 00:00 diff --git a/test/unit/specs/components/transactions/__snapshots__/TmLiTransaction.spec.js.snap b/test/unit/specs/components/transactions/__snapshots__/TmLiTransaction.spec.js.snap index 064e645794..95b1f409da 100644 --- a/test/unit/specs/components/transactions/__snapshots__/TmLiTransaction.spec.js.snap +++ b/test/unit/specs/components/transactions/__snapshots__/TmLiTransaction.spec.js.snap @@ -48,7 +48,7 @@ exports[`TmLiTransaction has the expected html structure 1`] = ` > Block #500  - @ 12:00 am + @ 00:00 diff --git a/test/unit/specs/store/__snapshots__/transactions.spec.js.snap b/test/unit/specs/store/__snapshots__/transactions.spec.js.snap index 0545266178..e19b465788 100644 --- a/test/unit/specs/store/__snapshots__/transactions.spec.js.snap +++ b/test/unit/specs/store/__snapshots__/transactions.spec.js.snap @@ -731,7 +731,7 @@ Array [ Object { "hash": "A7C6DE5CB923AF08E6088F1348047F16BABB9F48", "height": 160, - "time": 10160, + "time": 42000, "tx": Object { "value": Object { "msg": Array [ @@ -754,7 +754,7 @@ Array [ Object { "hash": "A7C6FDE5CA923AF08E6088F1348047F16BABB9F48", "height": 170, - "time": 10170, + "time": 42000, "tx": Object { "value": Object { "msg": Array [ diff --git a/test/unit/specs/store/transactions.spec.js b/test/unit/specs/store/transactions.spec.js index 1d19196d9c..14f10cf3a9 100644 --- a/test/unit/specs/store/transactions.spec.js +++ b/test/unit/specs/store/transactions.spec.js @@ -50,13 +50,13 @@ describe(`Module: Transactions`, () => { blockHeight: `3436`, blockMetaInfo: { header: { - time: 1042 + time: 42000 } } }) expect( store.state.transactions.wallet.find(tx => tx.height === `3436`).time - ).toBe(1042) + ).toBe(42000) }) it(`should clear session data`, () => { From 20421390313a2907c54ebe93586e3f33ef4f4530 Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Fri, 4 Jan 2019 17:03:16 -0300 Subject: [PATCH 87/99] improve readme, fixes #1694 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eeba2d44ff..aa7a80c80f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -91,7 +91,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - [\#1724](https://github.com/cosmos/voyager/issues/1724) set tabindex attribute to -1 for readonly denom on ModalProposals. tab navgiation now skips element @enyan94 - [\#1277](https://github.com/cosmos/voyager/issues/1277) change name of VmToolBar to ToolBar, update all snapshots and import statements @coreycosman - [\#1432](https://github.com/cosmos/voyager/issues/1432) Moved @tendermint/UI components back into the Voyager repository @faboweb -- Improved the readme @faboweb +- [\#1694](https://github.com/cosmos/voyager/issues/1694) Improved the `README` @faboweb @fedekunze - [\#1792](https://github.com/cosmos/voyager/pull/1792) removed mocked demo mode @fedekunze ### Fixed From 6578766f3ff3de9f330ad0ddb41ae37fc91cb797 Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Fri, 4 Jan 2019 18:37:18 -0300 Subject: [PATCH 88/99] improve README --- README.md | 229 ++++++++++++++++++++++-------------------------------- 1 file changed, 91 insertions(+), 138 deletions(-) diff --git a/README.md b/README.md index d8ecd579e1..065723b3dd 100644 --- a/README.md +++ b/README.md @@ -15,23 +15,27 @@ # ⚠️ NO ACTIVE TESTNET ⚠️ -Currently there is no active testnet. You have to [prepare Voyager](#prerequesists) and then run a [local node](#local-node) to test Voyager out. This is only recommended for developers. +Currently there is no active testnet. You have to [prepare Voyager](#prerequisites) and then run a [local testnet](#local-testnet) to test Voyager out. This is only recommended for developers. --- -## Voyager Prerequisites +## Voyager Prerequisites -### Check Out Voyager +Install the following developer dependencies. -Voyager requires Node.js `>=10.13.0`. If you have a different version of Node.js installed (e.g. Node.js `8.11 LTS`), you can use `n` to install the correct version. The following command will use `n` to install it alongside your current version of Node.js. +### Node + +Voyager requires Node.js `>=10.13.0`. If you have a different version of Node.js installed, you can use `n` to install the correct version. The following command will use `n` to install it alongside your current version of Node.js. ```bash npm i -g n && n 10.13.0 ``` -Yarn is a JS package packager we use manage Voyager dependencies. [Download it.](https://yarnpkg.com/lang/en/docs/install) +### Yarn + +Yarn is a JS package packager we use manage Voyager dependencies. Download i [here](https://yarnpkg.com/lang/en/docs/install). -With Node.js and Yarn installed, you're ready to check out the source code: +With Node and Yarn installed, you're ready to check out the source code: ```bash git clone https://github.com/cosmos/voyager.git @@ -43,7 +47,11 @@ yarn install Building Voyager and its dependencies requires [Docker](https://www.docker.com/get-docker) installed. -#### Build Gaia (Cosmos SDK) +--- + +To run Voyager we need to install Gaia (the Cosmos Hub application) and download the supported testnets. + +### Gaia (Cosmos SDK) Build the Gaia CLI (`gaiacli`) and full node (`gaiad`), which are part of the Cosmos SDK, with the following command: @@ -55,7 +63,7 @@ yarn build:gaia The version built is specified in `tasks/build/Gaia/COMMIT.sh` and the programs are placed in the `builds/Gaia` directory. -### Testnet Configurations +### Testnets To connect to a testnet, Voyager needs the configuration files of those networks in the folder `app/networks/{network_name}`. Gaia has a Git repository that holds the configuration files. Voyager has script to download those configurations for you: @@ -67,213 +75,162 @@ yarn build:testnets ## Voyager Development -To run Voyager on the default testnet: - -```bash -$ yarn start -``` +### Active testnets -To run Voyager on a specific testnet, see the [status page](https://github.com/cosmos/cosmos-sdk/blob/develop/cmd/gaia/testnets/STATUS.md) for a list of available testnets. +To run Voyager on the default testnet (if active): ```bash -$ yarn start +yarn start ``` -To run Voyager on a local node: - - - -First, start a full node following the [testnet instructions](https://cosmos.network/join-testnet). - -Then start Voyager pointing at your local node. +To run Voyager on a specific testnet you can use the following command. Click [here](https://github.com/cosmos/testnets) for a complete list of the supported official and community testnets. ```bash -$ COSMOS_NODE=localhost yarn start +yarn start ``` ---- +## Local testnet -### Building Voyager Binaries - -First [Build Gaia](#build-gaia) and [Download the testnet configurations](#download-testnets). - -Here's an example build command: - -```bash -yarn run build --commit=HEAD --network=gaia-8001 -``` +Sometimes you may want to run a local node, i.e. in the case there is no available network. To do so first [Build Gaia](#build-gaia), then use our automatic script or the manual process to set up your node. -You can specify `--help` to see all options with explanations. +### Build -When the build is complete, you can find the files in `builds/Voyager`. +#### Automatically -To test if your build worked run: +You can do the entire process in one command by running: ```bash -$ yarn test:exe {path to the unpacked executable} +yarn build:local --overwrite=true ``` -To make an official release, follow the instructions in `docs/release.md`. +(Be careful with the --overwrite flag as it will remove previous local node configurations) -#### Building without Docker +#### Manually -You can also skip docker for bundling the Electron application but the builds will no longer be deterministic. +You can do the entire process manually by following these steps: + +First initialize your node: ```bash -node tasks/build/build.js --os darwin --binaryPath $GOPATH/bin/gaiacli +builds/Gaia/{OS}/gaiad init --home ~/.gaiad-testnet --name local ``` -`--os` can be `darwin`, `linux`, `win32`. - ---- - -## Testing +Write down the 12 word secret phrase to be able to import an account that holds tokens later on. -If you would like to run all the tests you can run: +Copy the configuration files (assuming you are in the Voyager dir): ```bash -$ yarn test +mkdir builds/testnets/local-testnet +cp ~/.gaiad-testnet/config/{genesis.json,config.toml} builds/testnets/local-testnet/ ``` -### Unit Tests - -Voyager is using [Jest](https://facebook.github.io/jest) to run unit tests. +Enter your local node as a seed: ```bash -$ yarn test:unit +sed -i.bak 's/seeds = ""/seeds = "localhost"/g' ./builds/testnets/local-testnet/config.toml ``` -You can run the unit tests for a single file (e.g., -PageValidator.spec.js) whenever there are changes like this: +Activate TX indexing in your local node: -```shell -$ yarn watch PageValidator +```bash +sed -i.bak 's/index_all_tags = false/index_all_tags = true/g' ~/.gaiad-testnet/config/config.toml ``` -### Coverage - -To check test coverage locally run following. It will spin up a webserver and provide you with a link to the coverage report web page. +Store the gaia version used in your local testnet: ```bash -$ yarn test:coverage +./builds/Gaia/{OS}/gaiad version > ./builds/testnets/local-testnet/gaiaversion.txt ``` -### End to end +### Deploy -End to end testing is performed via `tape`, you can run all of them using: +Run Voyager for your local testnet: ```bash -$ yarn test:e2e +yarn start local-testnet ``` -If you would like to run a single test please set the TEST variable (Unix systems): +Import the account with the 12 word seed phrase you wrote down earlier. -```bash -$ TEST=test/e2e/init.js yarn test:e2e -``` +### Running several nodes -You can also run the `tape` command directly, but then you need to run the packaging of Voyager before it (i.e. necessary on Windows): +This command will build and run several nodes at once on the local testnet. All nodes will be validators: ```bash -$ yarn pack -$ node_modules/.bin/tape test/e2e/init.js +yarn start local-testnet ``` --- -## Debug +## Testing -To debug the electron application, build it and run the node inspector for the built files: +If you would like to run all the tests you can run: ```bash -$ electron --inspect-brk builds/{{your build}}/resources/app/dist/main.js +yarn test ``` -Then attach to the debugger via the posted url in Chrome. - -To debug the electron view, set the environment variable `COSMOS_DEVTOOLS` to something truthy like `"true"`. The Chrome DevTools will appear when you start Voyager. - -To see the console output of the view in your terminal, set the environment variable `ELECTRON_ENABLE_LOGGING` to something truthy like `1`. - ---- - -## Run a local node - -Sometimes you may want to run a local node, i.e. in the case there is no available network. To do so first [Build Gaia](#build-gaia), then use our automatic script or the manual process to set up your node. +### Unit tests -### Automatically - -You can do the entire process in one command by running: +Voyager is using [Jest](https://facebook.github.io/jest) to run unit tests. ```bash -$ yarn build:local --overwrite=true +yarn test:unit ``` -(Be careful with the --overwrite flag as it will remove previous local node configurations) - -### Manually - -You can do the entire process manually by following these steps: - -First initialize your node: +You can run the unit tests for a single file (e.g., +PageValidator.spec.js) whenever there are changes like this: ```bash -$ builds/Gaia/{OS}/gaiad init --home ~/.gaiad-testnet --name local +yarn watch PageValidator ``` -Write down the 12 word secret phrase to be able to import an account that holds tokens later on. +### End to end tests -Copy the configuration files (assuming you are in the Voyager dir): +End to end (e2e) testing is performed via `tape`, you can run all of them using: ```bash -$ mkdir builds/testnets/local-testnet -$ cp ~/.gaiad-testnet/config/{genesis.json,config.toml} builds/testnets/local-testnet/ +yarn test:e2e ``` -Enter your local node as a seed: +If you would like to run a single test please set the TEST variable (Unix systems): ```bash -$ sed -i.bak 's/seeds = ""/seeds = "localhost"/g' ./builds/testnets/local-testnet/config.toml +TEST=test/e2e/init.js yarn test:e2e ``` -Activate TX indexing in your local node: +You can also run the `tape` command directly, but then you need to run the packaging of Voyager before it (i.e. necessary on Windows): ```bash -$ sed -i.bak 's/index_all_tags = false/index_all_tags = true/g' ~/.gaiad-testnet/config/config.toml +yarn pack +node_modules/.bin/tape test/e2e/init.js ``` -Store the gaia version used in your local testnet: +### Code coverage + +To check test coverage locally run following. It will spin up a webserver and provide you with a link to the coverage report web page. ```bash -$ ./builds/Gaia/{OS}/gaiad version > ./builds/testnets/local-testnet/gaiaversion.txt +yarn test:coverage ``` -Start your local node: +--- -```bash -$ ./builds/Gaia/{OS}/gaiad start --home ~/.gaiad-testnet -``` +## Debugging -Then run Voyager for your local testnet: +To debug the Electron application, build it and run the node inspector for the built files: ```bash -$ yarn start local-testnet +electron --inspect-brk builds/{{your build}}/resources/app/dist/main.js ``` -Import the account with the 12 word seed phrase you wrote down earlier. +Then attach to the debugger via the posted url in Chrome. -### Run several nodes +To debug the electron view, set the environment variable `COSMOS_DEVTOOLS` to something truthy like `"true"`. The Chrome DevTools will appear when you start Voyager. -This command will build and run several nodes at once. All nodes will be validators: +To see the console output of the view in your terminal, set the environment variable `ELECTRON_ENABLE_LOGGING` to something truthy like `1`. -```bash -$ yarn start local-testnet 5 -``` +--- ## Flags @@ -301,38 +258,34 @@ A list of all environment variables and their purpose: - If you use yarn, the post-install hook may not execute. If this happens you'll have to execute the script manually: ```bash -$ cd app -$ yarn -$ cd .. -$ npm run rebuild +cd app +yarn +cd .. +npm run rebuild ``` - If electron shows the error: `A DLL initialization routine has failed.` rebuild the electron dependencies: ```bash -$ npm run rebuild +npm run rebuild ``` - If you have trouble installing dependencies, remove all the lockfiles and try installing again. ```bash -$ rm -rf app/yarn.lock -$ rm -rf app/package-lock.json -$ rm -rf yarn.lock -$ rm -rf package-lock.json +rm -rf app/yarn.lock +rm -rf app/package-lock.json +rm -rf yarn.lock +rm -rf package-lock.json ``` - If your components are not found using a short path, check if the path resolution is applied for Webpack (`webpack.renderer.js > rendererConfig.resolve.alias`) and Jest (`package.json > jest.moduleNameMapper`). - If starting the development server fails with the error: `Error: listen EADDRINUSE 127.0.0.1:9080`, you have still a development server process running. Kill it with `kill $(lsof -t -i:9080)` on Unix systems. On Windows Powershell first look for the processes with `netstat -a -o -n | Select-String -Pattern "9080"` then kill them with `taskkill /F /PID {PID}`. -* If `yarn test:e2e` outputs an error about ChromeDriver timeout, remove your node_modules folder and reinstall all dependencies. +- If `yarn test:e2e` outputs an error about ChromeDriver timeout, remove your `node_modules` folder and reinstall all dependencies with `yarn`. - The version mismatch (`The network you are trying to connect to requires gaia X, but the version Voyager is using is Y.`) is testing the gaia version in `/builds/Gaia/...` against the one specified in the config dir `~/.cosmos-voyager[-dev]/{NETWORK}/gaiaversion.txt`. If you know that you have the correct version, change it in `gaiaversion.txt`. -* You get `The network configuration for the network you want to connect to doesn't exist. Have you run "yarn build:testnets" to download the latest configurations?` but you have run `yarn build:testnets`. +- You get `The network configuration for the network you want to connect to doesn't exist. Have you run "yarn build:testnets" to download the latest configurations?` but you have run `yarn build:testnets`. The symlink between `app/networks` and `builds/testnets` is broken. Try readding the symlink with `cd app && ln -s ../builds/testnets networks`. - ---- - -## ✌️ From 4c22078dd4135eace8b1d2729c142f5739bcabd5 Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Fri, 4 Jan 2019 22:30:53 -0300 Subject: [PATCH 89/99] more updates on README --- README.md | 91 ++++++++++++++++++++++++------------------------------- 1 file changed, 40 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index 065723b3dd..945c6383e3 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![CircleCI](https://circleci.com/gh/cosmos/voyager.svg?style=svg)](https://circleci.com/gh/cosmos/voyager) [![codecov](https://codecov.io/gh/cosmos/voyager/branch/develop/graph/badge.svg)](https://codecov.io/gh/cosmos/voyager) -👋 Welcome to Voyager, the official desktop application for the [Cosmos Network](https://cosmos.network/). +👋 Welcome to Voyager, the official wallet and UI for the [Cosmos Hub](https://cosmos.network/). ⚠️ This is still alpha-level software. **DO NOT** enter your Cosmos fundraiser seed into Voyager. @@ -13,15 +13,15 @@ -# ⚠️ NO ACTIVE TESTNET ⚠️ + -Currently there is no active testnet. You have to [prepare Voyager](#prerequisites) and then run a [local testnet](#local-testnet) to test Voyager out. This is only recommended for developers. +## ⚠️ NO ACTIVE TESTNET ⚠️ ---- +**NOTE:** Currently there is no active testnet. You have to [install Voyager dependencies](#voyager-dependencies) and then run a [local testnet](#local-testnet) to test Voyager out. This is only recommended for developers. -## Voyager Prerequisites +## Voyager Dependencies -Install the following developer dependencies. +Install the following dependencies if you wish to run voyager on developer mode or [contribute](https://github.com/cosmos/voyager/blob/develop/CONTRIBUTING.md). ### Node @@ -33,9 +33,15 @@ npm i -g n && n 10.13.0 ### Yarn -Yarn is a JS package packager we use manage Voyager dependencies. Download i [here](https://yarnpkg.com/lang/en/docs/install). +Yarn is a JS package packager we use manage Voyager dependencies. Download it [here](https://yarnpkg.com/lang/en/docs/install). -With Node and Yarn installed, you're ready to check out the source code: +### Docker + +Building Voyager and its dependencies requires [Docker](https://www.docker.com/) installed. You can download it [here](https://www.docker.com/get-docker). + +### Check out Voyager + +With Node, Yarn and Docker installed, you're ready to check out the source code: ```bash git clone https://github.com/cosmos/voyager.git @@ -43,27 +49,19 @@ cd voyager yarn install ``` -### Docker - -Building Voyager and its dependencies requires [Docker](https://www.docker.com/get-docker) installed. +### Gaia (Cosmos SDK) ---- +Since Voyager runs on top of the Cosmos Hub blockchain, we also need to install Gaia (the Cosmos Hub application) and download the supported testnets. -To run Voyager we need to install Gaia (the Cosmos Hub application) and download the supported testnets. - -### Gaia (Cosmos SDK) - -Build the Gaia CLI (`gaiacli`) and full node (`gaiad`), which are part of the -Cosmos SDK, with the following command: +Open the Docker App and build the Gaia CLI (`gaiacli`) and the full node (`gaiad`), which are part of the Cosmos SDK, with the following command: ```bash yarn build:gaia ``` -The version built is specified in `tasks/build/Gaia/COMMIT.sh` and the programs -are placed in the `builds/Gaia` directory. +The version built is specified in `tasks/build/Gaia/COMMIT.sh` and the programs are placed in the `builds/Gaia` directory. -### Testnets +### Testnets To connect to a testnet, Voyager needs the configuration files of those networks in the folder `app/networks/{network_name}`. Gaia has a Git repository that holds the configuration files. Voyager has script to download those configurations for you: @@ -71,8 +69,6 @@ To connect to a testnet, Voyager needs the configuration files of those networks yarn build:testnets ``` ---- - ## Voyager Development ### Active testnets @@ -89,9 +85,9 @@ To run Voyager on a specific testnet you can use the following command. Click [h yarn start ``` -## Local testnet +## Local testnet -Sometimes you may want to run a local node, i.e. in the case there is no available network. To do so first [Build Gaia](#build-gaia), then use our automatic script or the manual process to set up your node. +Sometimes you may want to run a local node, i.e. in the case there is no available network. To do so first [Build Gaia](#gaia-cosmos-sdk), then use our automatic script or the manual process to set up your node. ### Build @@ -160,8 +156,6 @@ This command will build and run several nodes at once on the local testnet. All yarn start local-testnet ``` ---- - ## Testing If you would like to run all the tests you can run: @@ -172,14 +166,13 @@ yarn test ### Unit tests -Voyager is using [Jest](https://facebook.github.io/jest) to run unit tests. +Voyager uses [Jest](https://facebook.github.io/jest) to run unit tests. You can run _all_ the unit tests with the following command: ```bash yarn test:unit ``` -You can run the unit tests for a single file (e.g., -PageValidator.spec.js) whenever there are changes like this: +For a single test file (e.g. `PageValidator.spec.js` ) run the unit tests like this to watch the tests whenever there are changes: ```bash yarn watch PageValidator @@ -187,7 +180,7 @@ yarn watch PageValidator ### End to end tests -End to end (e2e) testing is performed via `tape`, you can run all of them using: +End to end (e2e) testing is performed via [`tape`](https://github.com/substack/tape), you can run all of them using: ```bash yarn test:e2e @@ -199,7 +192,7 @@ If you would like to run a single test please set the TEST variable (Unix system TEST=test/e2e/init.js yarn test:e2e ``` -You can also run the `tape` command directly, but then you need to run the packaging of Voyager before it (i.e. necessary on Windows): +You can also run the `tape` command directly, but then you need to run the packaging of Voyager before it (_i.e._ necessary on Windows): ```bash yarn pack @@ -214,8 +207,6 @@ To check test coverage locally run following. It will spin up a webserver and pr yarn test:coverage ``` ---- - ## Debugging To debug the Electron application, build it and run the node inspector for the built files: @@ -224,32 +215,30 @@ To debug the Electron application, build it and run the node inspector for the b electron --inspect-brk builds/{{your build}}/resources/app/dist/main.js ``` -Then attach to the debugger via the posted url in Chrome. +Then attach to the debugger via the posted URL in Chrome. To debug the electron view, set the environment variable `COSMOS_DEVTOOLS` to something truthy like `"true"`. The Chrome DevTools will appear when you start Voyager. To see the console output of the view in your terminal, set the environment variable `ELECTRON_ENABLE_LOGGING` to something truthy like `1`. ---- - ## Flags A list of all environment variables and their purpose: -| Variable | Values | default | Purpose | -| ----------------------- | ---------------------------------------- | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| NODE_ENV | 'production', 'development' | | | -| LOGGING | 'true', 'false' | 'true' | Disable logging | -| COSMOS_NETWORK | {path to network configuration folder} | '../networks/gaia-7001' | Network to connect to | -| COSMOS_HOME | {path to config persistence folder} | '\$HOME/.cosmos-voyager[-dev]' | | -| LCD_URL | {URL of a Cosmos light client interface} | see 'app/config.toml' | Cosmos Light Client interface to connect to | -| RPC_URL | {URL of a Tendermint rpc interface} | see 'app/config.toml' | Tendermint node to connect to | -| COSMOS_DEVTOOLS | 'true', 'false' | 'false' | Open the debug panel in the electron view | -| ELECTRON_ENABLE_LOGGING | 'true', 'false' | 'false' | Redirect the browser view console output to the console | -| PREVIEW | 'true', 'false' | 'true' if NODE_ENV 'development' | Show/Hide features that are in development | -| COSMOS_E2E_KEEP_OPEN | 'true', 'false' | 'false' | Keep the Window open in local E2E test to see the state in which the application broke. | -| CI | 'true', 'false' | 'false' | Adds better structured output, makes a screenshot and adds logs to files (used on CircleCI). | -| ALLOW_CONSOLE | 'true', 'false' | 'false' | Unit tests fail if they use console.error or console.warn. To see the initial use/occurences of those callings, you can escape this behavior using this flag. | +| Variable | Values | default | Purpose | +| ------------------------- | ---------------------------------------- | -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `NODE_ENV` | 'production', 'development' | | | +| `LOGGING` | 'true', 'false' | 'true' | Disable logging | +| `COSMOS_NETWORK` | {path to network configuration folder} | '../networks/gaia-7001' | Network to connect to | +| `COSMOS_HOME` | {path to config persistence folder} | '\$HOME/.cosmos-voyager[-dev]' | | +| `LCD_URL` | {URL of a Cosmos light client interface} | see 'app/config.toml' | Cosmos Light Client interface to connect to | +| `RPC_URL` | {URL of a Tendermint rpc interface} | see 'app/config.toml' | Tendermint node to connect to | +| `COSMOS_DEVTOOLS` | 'true', 'false' | 'false' | Open the debug panel in the electron view | +| `ELECTRON_ENABLE_LOGGING` | 'true', 'false' | 'false' | Redirect the browser view console output to the console | +| `PREVIEW` | 'true', 'false' | 'true' if NODE_ENV 'development' | Show/Hide features that are in development | +| `COSMOS_E2E_KEEP_OPEN` | 'true', 'false' | 'false' | Keep the Window open in local E2E test to see the state in which the application broke. | +| `CI` | 'true', 'false' | 'false' | Adds better structured output, makes a screenshot and adds logs to files (used on CircleCI). | +| `ALLOW_CONSOLE` | 'true', 'false' | 'false' | Unit tests fail if they use `console.error` or `console.warn`. To see the initial use/occurences of those callings, you can escape this behavior using this flag. | ## FAQ From c94eb03353a8cf0c1d691f1beb289886e1bc66e0 Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Fri, 4 Jan 2019 22:47:26 -0300 Subject: [PATCH 90/99] update flags table --- README.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 945c6383e3..0e6b6f1116 100644 --- a/README.md +++ b/README.md @@ -225,20 +225,20 @@ To see the console output of the view in your terminal, set the environment vari A list of all environment variables and their purpose: -| Variable | Values | default | Purpose | -| ------------------------- | ---------------------------------------- | -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `NODE_ENV` | 'production', 'development' | | | -| `LOGGING` | 'true', 'false' | 'true' | Disable logging | -| `COSMOS_NETWORK` | {path to network configuration folder} | '../networks/gaia-7001' | Network to connect to | -| `COSMOS_HOME` | {path to config persistence folder} | '\$HOME/.cosmos-voyager[-dev]' | | -| `LCD_URL` | {URL of a Cosmos light client interface} | see 'app/config.toml' | Cosmos Light Client interface to connect to | -| `RPC_URL` | {URL of a Tendermint rpc interface} | see 'app/config.toml' | Tendermint node to connect to | -| `COSMOS_DEVTOOLS` | 'true', 'false' | 'false' | Open the debug panel in the electron view | -| `ELECTRON_ENABLE_LOGGING` | 'true', 'false' | 'false' | Redirect the browser view console output to the console | -| `PREVIEW` | 'true', 'false' | 'true' if NODE_ENV 'development' | Show/Hide features that are in development | -| `COSMOS_E2E_KEEP_OPEN` | 'true', 'false' | 'false' | Keep the Window open in local E2E test to see the state in which the application broke. | -| `CI` | 'true', 'false' | 'false' | Adds better structured output, makes a screenshot and adds logs to files (used on CircleCI). | -| `ALLOW_CONSOLE` | 'true', 'false' | 'false' | Unit tests fail if they use `console.error` or `console.warn`. To see the initial use/occurences of those callings, you can escape this behavior using this flag. | +| Variable | Values | default | Purpose | +| ------------------------- | ---------------------------------------- | ------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `NODE_ENV` | `production`, `development` | | | +| `LOGGING` | `true`, `false` | `true` | Disable logging | +| `COSMOS_NETWORK` | {path to network configuration folder} | | Network to connect to | +| `COSMOS_HOME` | {path to config persistence folder} | `\$HOME/.cosmos-voyager[-dev]` | | +| `LCD_URL` | {URL of a Cosmos light client interface} | see [`config`](https://github.com/cosmos/voyager/blob/develop/app/config.toml) | Cosmos Light Client interface to connect to | +| `RPC_URL` | {URL of a Tendermint rpc interface} | see [`config`](https://github.com/cosmos/voyager/blob/develop/app/config.toml) | Tendermint node to connect to | +| `COSMOS_DEVTOOLS` | `true`, `false` | `false` | Open the debug panel in the electron view | +| `ELECTRON_ENABLE_LOGGING` | `true`, `false` | `false` | Redirect the browser view console output to the console | +| `PREVIEW` | `true`, `false` | `true` if `NODE_ENV=development` | Show/Hide features that are in development | +| `COSMOS_E2E_KEEP_OPEN` | `true`, `false` | `false` | Keep the Window open in local E2E test to see the state in which the application broke. | +| `CI` | `true`, `false` | `false` | Adds better structured output, makes a screenshot and adds logs to files (used on CircleCI). | +| `ALLOW_CONSOLE` | `true`, `false` | `false` | Unit tests fail if they use `console.error` or `console.warn`. To see the initial use/occurences of those callings, you can escape this behavior using this flag. | ## FAQ From de04714773cb4e84d7400b7774b49c96cf3d77fe Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Fri, 4 Jan 2019 23:09:41 -0300 Subject: [PATCH 91/99] default pwd for local-testnet --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0e6b6f1116..4c73a620b2 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,9 @@ You can do the entire process in one command by running: yarn build:local --overwrite=true ``` -(Be careful with the --overwrite flag as it will remove previous local node configurations) +Once the build is done, it will print a success message on the Terminal with the default username/account and password to connect to the local testnet. + +**Note:** the `--overwrite` flag as it will remove previous local node configurations #### Manually @@ -111,7 +113,7 @@ First initialize your node: builds/Gaia/{OS}/gaiad init --home ~/.gaiad-testnet --name local ``` -Write down the 12 word secret phrase to be able to import an account that holds tokens later on. +Write down the 24 word secret phrase to be able to import an account that holds tokens later on. Copy the configuration files (assuming you are in the Voyager dir): @@ -146,7 +148,7 @@ Run Voyager for your local testnet: yarn start local-testnet ``` -Import the account with the 12 word seed phrase you wrote down earlier. +Once the app is running it will redirect you to the `Sign In` page. Here you need to select an account and input the password given (if you used the [auto build](#automatically); default `1234567890`). ### Running several nodes From 8aaa7d32e80aa47a39181bc1761d5843768fabec Mon Sep 17 00:00:00 2001 From: Karoly Albert Szabo Date: Mon, 7 Jan 2019 11:23:21 +0100 Subject: [PATCH 92/99] - fix height type to be int for all transaction types - for transactions older than today, show all date Signed-off-by: Karoly Albert Szabo --- app/src/renderer/components/transactions/TmLiTransaction.vue | 5 ++++- app/src/renderer/vuex/modules/transactions.js | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/renderer/components/transactions/TmLiTransaction.vue b/app/src/renderer/components/transactions/TmLiTransaction.vue index 85dd897cc9..eab9939cf2 100644 --- a/app/src/renderer/components/transactions/TmLiTransaction.vue +++ b/app/src/renderer/components/transactions/TmLiTransaction.vue @@ -47,7 +47,10 @@ export default { }, computed: { date() { - return moment(this.time).format(`HH:mm`) + const time = moment(this.time) + return time.format( + `${moment().isSame(time, `day`) ? `` : `YYYY/MM/DD `}HH:mm` + ) } } } diff --git a/app/src/renderer/vuex/modules/transactions.js b/app/src/renderer/vuex/modules/transactions.js index 52eab2641e..d54c686758 100644 --- a/app/src/renderer/vuex/modules/transactions.js +++ b/app/src/renderer/vuex/modules/transactions.js @@ -108,7 +108,9 @@ export default ({ node }) => { return response ? uniqBy(transactionsPlusType, `hash`) : [] }, async enrichTransactions({ dispatch }, { transactions }) { - const blockHeights = new Set(transactions.map(({ height }) => height)) + const blockHeights = new Set( + transactions.map(({ height }) => parseInt(height)) + ) await Promise.all( [...blockHeights].map(blockHeight => dispatch(`queryTransactionTime`, { blockHeight }) From 8e7e5cdfcb59339e382f01799f47811103b56bf2 Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Mon, 7 Jan 2019 11:19:33 -0300 Subject: [PATCH 93/99] add getters for denoms --- .../renderer/components/common/TmBalance.vue | 6 ++-- .../components/common/TmOnboarding.vue | 8 ++--- .../components/governance/PageGovernance.vue | 10 +----- .../components/governance/PageProposal.vue | 5 +-- .../components/staking/DelegationModal.vue | 9 +++--- .../components/staking/PageValidator.vue | 31 +++++++------------ .../components/staking/TabMyDelegations.vue | 6 ++-- .../components/staking/TableValidators.vue | 10 +++--- .../components/staking/UndelegationModal.vue | 9 +++--- .../components/wallet/PageTransactions.vue | 4 +-- app/src/renderer/vuex/getters.js | 4 +++ .../governance/PageProposal.spec.js | 6 +++- .../staking/DelegationModal.spec.js | 10 ++---- .../components/staking/PageValidator.spec.js | 18 +++++------ .../staking/TabMyDelegations.spec.js | 11 ++++--- .../staking/UndelegationModal.spec.js | 10 ++---- .../__snapshots__/PageValidator.spec.js.snap | 6 ++-- 17 files changed, 70 insertions(+), 93 deletions(-) diff --git a/app/src/renderer/components/common/TmBalance.vue b/app/src/renderer/components/common/TmBalance.vue index 742c6c9168..d7783b9a34 100644 --- a/app/src/renderer/components/common/TmBalance.vue +++ b/app/src/renderer/components/common/TmBalance.vue @@ -5,11 +5,11 @@
-

Total {{ stakingParameters.parameters.bond_denom }}

+

Total {{ bondDenom }}

{{ num.shortNumber(totalAtoms) }}

-

Available {{ stakingParameters.parameters.bond_denom }}

+

Available {{ bondDenom }}

{{ unbondedAtoms }}

@@ -51,7 +51,7 @@ export default { } }, computed: { - ...mapGetters([`user`, `totalAtoms`, `stakingParameters`]), + ...mapGetters([`user`, `totalAtoms`, `bondDenom`]), address() { return this.user.address }, diff --git a/app/src/renderer/components/common/TmOnboarding.vue b/app/src/renderer/components/common/TmOnboarding.vue index f1aaa1ee50..4664a20a71 100644 --- a/app/src/renderer/components/common/TmOnboarding.vue +++ b/app/src/renderer/components/common/TmOnboarding.vue @@ -53,7 +53,7 @@ export default { name: `tm-onboarding`, components: { TmBtn, TmBarDiscrete }, computed: { - ...mapGetters([`onboarding`, `stakingParameters`]), + ...mapGetters([`onboarding`, `bondDenom`]), activeKey() { return this.onboarding.state }, @@ -62,10 +62,8 @@ export default { `This is a quick tour of the primary features of Cosmos Voyager.`, `You can send and receive Cosmos tokens from anyone around the world.`, `You can delegate your ${ - this.stakingParameters.parameters.bond_denom - } to Cosmos Validators to earn even more ${ - this.stakingParameters.parameters.bond_denom - }.`, + this.bondDenom + } to Cosmos Validators to earn even more ${this.bondDenom}.`, `Through governance, you can vote on the future of the Cosmos Network.`, `Start using Voyager to explore the Cosmos Network!` ] diff --git a/app/src/renderer/components/governance/PageGovernance.vue b/app/src/renderer/components/governance/PageGovernance.vue index cff3575fe2..c1044cc775 100644 --- a/app/src/renderer/components/governance/PageGovernance.vue +++ b/app/src/renderer/components/governance/PageGovernance.vue @@ -67,15 +67,7 @@ export default { showModalPropose: false }), computed: { - ...mapGetters([ - `proposals`, - `filters`, - `connected`, - `governanceParameters` - ]), - depositDenom() { - return this.governanceParameters.parameters.deposit.min_deposit[0].denom - } + ...mapGetters([`proposals`, `filters`, `connected`, `depositDenom`]) }, mounted() { this.ps = new PerfectScrollbar(this.$el.querySelector(`.tm-page-main`)) diff --git a/app/src/renderer/components/governance/PageProposal.vue b/app/src/renderer/components/governance/PageProposal.vue index cce100715b..f2f54b506b 100644 --- a/app/src/renderer/components/governance/PageProposal.vue +++ b/app/src/renderer/components/governance/PageProposal.vue @@ -158,7 +158,7 @@ export default { }), computed: { ...mapGetters([ - `governanceParameters`, + `depositDenom`, `proposals`, `connected`, `wallet`, @@ -234,9 +234,6 @@ export default { message: `There was an error determining the status of this proposal.`, color: `grey` } - }, - depositDenom() { - return this.governanceParameters.parameters.deposit.min_deposit[0].denom } }, methods: { diff --git a/app/src/renderer/components/staking/DelegationModal.vue b/app/src/renderer/components/staking/DelegationModal.vue index 7b6b9b8610..4ab2477d17 100644 --- a/app/src/renderer/components/staking/DelegationModal.vue +++ b/app/src/renderer/components/staking/DelegationModal.vue @@ -17,7 +17,7 @@ > @@ -122,6 +122,10 @@ export default { to: { type: String, required: true + }, + denom: { + type: String, + required: true } }, data: () => ({ @@ -130,9 +134,6 @@ export default { password: ``, showPassword: false }), - computed: { - ...mapGetters([`stakingParameters`]) - }, validations() { return { amount: { diff --git a/app/src/renderer/components/staking/PageValidator.vue b/app/src/renderer/components/staking/PageValidator.vue index d1d3459bf5..d239f0241d 100644 --- a/app/src/renderer/components/staking/PageValidator.vue +++ b/app/src/renderer/components/staking/PageValidator.vue @@ -51,7 +51,7 @@
-
Delegated {{ stakingParameters.parameters.bond_denom }}
+
Delegated {{ bondDenom }}
{{ myBond.isLessThan(0.01) && myBond.isGreaterThan(0) @@ -149,16 +149,11 @@
-
- Self Delegated {{ stakingParameters.parameters.bond_denom }} -
+
Self Delegated {{ bondDenom }}
{{ selfBond }} %
-
- Minimum Self Delegated - {{ stakingParameters.parameters.bond_denom }} -
+
Minimum Self Delegated {{ bondDenom }}
0 %
@@ -169,6 +164,7 @@ :show-delegation-modal.sync="showDelegationModal" :from-options="delegationTargetOptions()" :to="validator.operator_address" + :denom="bondDenom" @submitDelegation="submitDelegation" /> @@ -183,7 +180,7 @@ Cannot {{ action == `delegate` ? `Delegate` : `Undelegate` }}

- You have no {{ stakingParameters.parameters.bond_denom }}s + You have no {{ bondDenom }}s {{ action == `undelegate` ? ` delegated ` : ` ` }}to {{ action == `delegate` ? ` delegate.` : ` this validator.` }}

@@ -245,7 +242,7 @@ export default { }), computed: { ...mapGetters([ - `stakingParameters`, + `bondDenom`, `delegates`, `delegation`, `committedDelegations`, @@ -391,15 +388,11 @@ export default { this.$store.commit(`notify`, { title: `Successful ${txTitle}!`, - body: `You have successfully ${txBody} your ${ - this.stakingParameters.parameters.bond_denom - }s` + body: `You have successfully ${txBody} your ${this.bondDenom}s` }) } catch ({ message }) { this.$store.commit(`notifyError`, { - title: `Error while ${txAction} ${ - this.stakingParameters.parameters.bond_denom - }s`, + title: `Error while ${txAction} ${this.bondDenom}s`, body: message }) } @@ -421,14 +414,12 @@ export default { this.$store.commit(`notify`, { title: `Successful Undelegation!`, body: `You have successfully undelegated ${amount} ${ - this.stakingParameters.parameters.bond_denom + this.bondDenom }s.` }) } catch ({ message }) { this.$store.commit(`notifyError`, { - title: `Error while undelegating ${ - this.stakingParameters.parameters.bond_denom - }s`, + title: `Error while undelegating ${this.bondDenom}s`, body: message }) } diff --git a/app/src/renderer/components/staking/TabMyDelegations.vue b/app/src/renderer/components/staking/TabMyDelegations.vue index 783817e415..a80170d62e 100644 --- a/app/src/renderer/components/staking/TabMyDelegations.vue +++ b/app/src/renderer/components/staking/TabMyDelegations.vue @@ -8,8 +8,8 @@
No Active Delegations
- Looks like you haven't delegated any - {{ stakingParameters.parameters.bond_denom }}s yet. Head over to the + Looks like you haven't delegated any {{ bondDenom }}s yet. Head over to + the validator list to make your first delegation!
@@ -53,7 +53,7 @@ export default { `delegates`, `delegation`, `committedDelegations`, - `stakingParameters`, + `bondDenom`, `connected` ]), undelegatedValidators( diff --git a/app/src/renderer/components/staking/TableValidators.vue b/app/src/renderer/components/staking/TableValidators.vue index 7c63ddf1f1..24fb144883 100644 --- a/app/src/renderer/components/staking/TableValidators.vue +++ b/app/src/renderer/components/staking/TableValidators.vue @@ -62,7 +62,7 @@ export default { `config`, `user`, `connected`, - `stakingParameters`, + `bondDenom`, `keybase` ]), address() { @@ -121,10 +121,10 @@ export default { class: `name` }, { - title: `Delegated ${this.stakingParameters.parameters.bond_denom}`, + title: `Delegated ${this.bondDenom}`, value: `your_votes`, tooltip: `Number of ${ - this.stakingParameters.parameters.bond_denom + this.bondDenom } you have delegated to the validator`, class: `your-votes` }, @@ -132,7 +132,7 @@ export default { title: `Rewards`, value: `your_rewards`, // TODO: use real rewards tooltip: `Rewards of ${ - this.stakingParameters.parameters.bond_denom + this.bondDenom } you have gained from the validator`, class: `your-rewards` // TODO: use real rewards }, @@ -140,7 +140,7 @@ export default { title: `Voting Power`, value: `percent_of_vote`, tooltip: `Percentage of ${ - this.stakingParameters.parameters.bond_denom + this.bondDenom } the validator has on The Cosmos Hub`, class: `percent_of_vote` }, diff --git a/app/src/renderer/components/staking/UndelegationModal.vue b/app/src/renderer/components/staking/UndelegationModal.vue index 252ca8065f..7b04c7d440 100644 --- a/app/src/renderer/components/staking/UndelegationModal.vue +++ b/app/src/renderer/components/staking/UndelegationModal.vue @@ -20,7 +20,7 @@ > @@ -112,6 +112,10 @@ export default { to: { type: String, required: true + }, + denom: { + type: String, + required: true } }, data: () => ({ @@ -119,9 +123,6 @@ export default { password: ``, showPassword: false }), - computed: { - ...mapGetters([`stakingParameters`]) - }, validations() { return { amount: { diff --git a/app/src/renderer/components/wallet/PageTransactions.vue b/app/src/renderer/components/wallet/PageTransactions.vue index b022b1c920..fdb23ae9e0 100644 --- a/app/src/renderer/components/wallet/PageTransactions.vue +++ b/app/src/renderer/components/wallet/PageTransactions.vue @@ -34,7 +34,7 @@ :key="tx.hash" :transaction="tx" :address="wallet.address" - :bonding-denom="stakingParameters.parameters.bond_denom" + :bonding-denom="bondDenom" :unbonding-time="getUnbondingTime(tx)" /> @@ -85,7 +85,7 @@ export default { `filters`, `allTransactions`, `wallet`, - `stakingParameters`, + `bondDenom`, `delegation`, `delegates`, `connected` diff --git a/app/src/renderer/vuex/getters.js b/app/src/renderer/vuex/getters.js index e8bafd5f36..8cefbb0eb4 100644 --- a/app/src/renderer/vuex/getters.js +++ b/app/src/renderer/vuex/getters.js @@ -65,12 +65,16 @@ export const validators = state => state.validators.validators export const keybase = state => state.keybase.identities export const pool = state => state.pool export const stakingParameters = state => state.stakingParameters +export const bondDenom = getters => + getters.stakingParameters.parameters.bond_denom // governance export const proposals = state => state.proposals export const votes = state => state.votes.votes export const deposits = state => state.deposits.deposits export const governanceParameters = state => state.governanceParameters +export const depositDenom = getters => + getters.governanceParameters.parameters.deposit.min_deposit[0].denom // status export const approvalRequired = state => state.connection.approvalRequired diff --git a/test/unit/specs/components/governance/PageProposal.spec.js b/test/unit/specs/components/governance/PageProposal.spec.js index fc4aedc454..b240d1c0c6 100644 --- a/test/unit/specs/components/governance/PageProposal.spec.js +++ b/test/unit/specs/components/governance/PageProposal.spec.js @@ -26,7 +26,11 @@ describe(`PageProposal`, () => { const $store = { commit: jest.fn(), dispatch: jest.fn(), - getters: { proposals: { proposals, tallies, stakingParameters } } + getters: { + proposals: { proposals, tallies }, + bondDenom: stakingParameters.parameters.bond_denom, + depositDenom: governanceParameters.deposit.min_deposit[0].denom + } } beforeEach(() => { diff --git a/test/unit/specs/components/staking/DelegationModal.spec.js b/test/unit/specs/components/staking/DelegationModal.spec.js index 6ad7285ac8..4f8e9567e0 100644 --- a/test/unit/specs/components/staking/DelegationModal.spec.js +++ b/test/unit/specs/components/staking/DelegationModal.spec.js @@ -37,14 +37,8 @@ describe(`DelegationModal`, () => { value: 2 } ], - to: `cosmosvaladdr15ky9du8a2wlstz6fpx3p4mqpjyrm5ctplpn3au` - }, - mocks: { - $store: { - getters: { - stakingParameters - } - } + to: `cosmosvaladdr15ky9du8a2wlstz6fpx3p4mqpjyrm5ctplpn3au`, + denom: stakingParameters.parameters.bond_denom } }) wrapper = instance.wrapper diff --git a/test/unit/specs/components/staking/PageValidator.spec.js b/test/unit/specs/components/staking/PageValidator.spec.js index 4538684f92..0ea9816990 100644 --- a/test/unit/specs/components/staking/PageValidator.spec.js +++ b/test/unit/specs/components/staking/PageValidator.spec.js @@ -6,7 +6,7 @@ import setup from "../../../helpers/vuex-setup" import PageValidator from "renderer/components/staking/PageValidator" import lcdClientMock from "renderer/connectors/lcdClientMock.js" -let { stakingParameters } = lcdClientMock.state +const { stakingParameters } = lcdClientMock.state const validator = Object.assign({}, lcdClientMock.state.candidates[0], { commission: { @@ -22,7 +22,6 @@ const validator = Object.assign({}, lcdClientMock.state.candidates[0], { const validatorTo = lcdClientMock.state.candidates[1] const getterValues = { - stakingParameters: stakingParameters, config: { desktop: false }, delegates: { delegates: [validator, validatorTo], @@ -41,7 +40,8 @@ const getterValues = { user: { atoms: 42 }, wallet: { address: `cosmos15ky9du8a2wlstz6fpx3p4mqpjyrm5ctpesxxn9` }, connected: true, - lastPage: null + lastPage: null, + bondDenom: stakingParameters.parameters.bond_denom } describe(`PageValidator`, () => { @@ -62,11 +62,13 @@ describe(`PageValidator`, () => { $route: { params: { validator: validator.operator_address } } + }, + getters: { + bondDenom: () => stakingParameters.parameters.bond_denom } }) wrapper = instance.wrapper store = instance.store - store.commit(`setStakingParameters`, stakingParameters.parameters) }) it(`has the expected html structure`, async () => { @@ -89,7 +91,8 @@ describe(`PageValidator`, () => { config: () => ({ desktop: false }), delegates: () => ({ delegates: [] - }) + }), + bondDenom: () => stakingParameters.parameters.bond_denom }, mocks: { $route: { @@ -100,7 +103,6 @@ describe(`PageValidator`, () => { wrapper = instance.wrapper store = instance.store - store.commit(`setStakingParameters`, stakingParameters.parameters) expect(wrapper.vm.$el).toMatchSnapshot() }) @@ -341,16 +343,15 @@ describe(`onDelegation`, () => { store.commit(`setDelegates`, [validator, validatorTo]) store.state.wallet.address = lcdClientMock.addresses[0] }, + getters: { bondDenom: () => stakingParameters.parameters.bond_denom }, mocks: { $route: { params: { validator: validator.operator_address } } } }) - wrapper = instance.wrapper store = instance.store - store.commit(`setStakingParameters`, stakingParameters.parameters) }) describe(`make sure we have enough atoms to delegate`, () => { @@ -473,7 +474,6 @@ describe(`onDelegation`, () => { const $store = { commit: jest.fn(), dispatch, - getters: getterValues, rootState: getterValues, state: { committedDelegates: { [lcdClientMock.validators[0]]: 0 }, diff --git a/test/unit/specs/components/staking/TabMyDelegations.spec.js b/test/unit/specs/components/staking/TabMyDelegations.spec.js index 1140a12ae5..9cca111f47 100644 --- a/test/unit/specs/components/staking/TabMyDelegations.spec.js +++ b/test/unit/specs/components/staking/TabMyDelegations.spec.js @@ -7,6 +7,7 @@ const delegates = lcdClientMock.candidates describe(`Component: TabMyDelegations`, () => { let { mount } = setup() + const { stakingParameters } = lcdClientMock.state it(`should show committed validators`, () => { let instance = mount(TabMyDelegations, { getters: { @@ -23,7 +24,7 @@ describe(`Component: TabMyDelegations`, () => { }, loaded: true }), - stakingParameters: () => lcdClientMock.state.stakingParameters, + bondDenom: () => stakingParameters.parameters.bond_denom, connected: () => true } }) @@ -45,7 +46,7 @@ describe(`Component: TabMyDelegations`, () => { }, loaded: true }), - stakingParameters: () => lcdClientMock.state.stakingParameters, + bondDenom: () => stakingParameters.parameters.bond_denom, connected: () => true } }) @@ -64,7 +65,7 @@ describe(`Component: TabMyDelegations`, () => { delegation: () => ({ unbondingDelegations: {} }), - stakingParameters: () => lcdClientMock.state.stakingParameters, + bondDenom: () => stakingParameters.parameters.bond_denom, connected: () => true } }) @@ -84,7 +85,7 @@ describe(`Component: TabMyDelegations`, () => { unbondingDelegations: {}, loaded: false }), - stakingParameters: () => lcdClientMock.state.stakingParameters, + bondDenom: () => stakingParameters.parameters.bond_denom, connected: () => false }, stubs: { @@ -107,7 +108,7 @@ describe(`Component: TabMyDelegations`, () => { loaded: true, loading: true }), - stakingParameters: () => lcdClientMock.state.stakingParameters, + bondDenom: () => stakingParameters.parameters.bond_denom, connected: () => false }, stubs: { diff --git a/test/unit/specs/components/staking/UndelegationModal.spec.js b/test/unit/specs/components/staking/UndelegationModal.spec.js index a093641171..de7403beee 100644 --- a/test/unit/specs/components/staking/UndelegationModal.spec.js +++ b/test/unit/specs/components/staking/UndelegationModal.spec.js @@ -18,14 +18,8 @@ describe(`UndelegationModal`, () => { localVue, propsData: { maximum: 100, - to: `cosmosvaladdr15ky9du8a2wlstz6fpx3p4mqpjyrm5ctplpn3au` - }, - mocks: { - $store: { - getters: { - stakingParameters - } - } + to: `cosmosvaladdr15ky9du8a2wlstz6fpx3p4mqpjyrm5ctplpn3au`, + denom: stakingParameters.parameters.bond_denom } }) wrapper = instance.wrapper diff --git a/test/unit/specs/components/staking/__snapshots__/PageValidator.spec.js.snap b/test/unit/specs/components/staking/__snapshots__/PageValidator.spec.js.snap index 83d8190da9..d764c97491 100644 --- a/test/unit/specs/components/staking/__snapshots__/PageValidator.spec.js.snap +++ b/test/unit/specs/components/staking/__snapshots__/PageValidator.spec.js.snap @@ -3592,7 +3592,7 @@ Array [ Array [ "notify", Object { - "body": "You have successfully undelegated 10 STAKEs.", + "body": "You have successfully undelegated 10 undefineds.", "title": "Successful Undelegation!", }, ], @@ -3675,7 +3675,7 @@ Array [ Array [ "notify", Object { - "body": "You have successfully delegated your STAKEs", + "body": "You have successfully delegated your undefineds", "title": "Successful delegation!", }, ], @@ -3779,7 +3779,7 @@ Array [ Array [ "notify", Object { - "body": "You have successfully redelegated your STAKEs", + "body": "You have successfully redelegated your undefineds", "title": "Successful redelegation!", }, ], From 5b7fcbb814a272fcf461d1a949d099e423e3a642 Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Mon, 7 Jan 2019 11:46:18 -0300 Subject: [PATCH 94/99] fix lint --- .../components/staking/DelegationModal.vue | 1 - .../renderer/components/staking/PageValidator.vue | 14 +++++--------- .../components/staking/UndelegationModal.vue | 1 - 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/app/src/renderer/components/staking/DelegationModal.vue b/app/src/renderer/components/staking/DelegationModal.vue index 4ab2477d17..3cdac85538 100644 --- a/app/src/renderer/components/staking/DelegationModal.vue +++ b/app/src/renderer/components/staking/DelegationModal.vue @@ -91,7 +91,6 @@