Skip to content

Commit

Permalink
Fabo/gaia 0.28.0 rc2 (#1725)
Browse files Browse the repository at this point in the history
* added e2e tests for balance updates for governance

* moved to 0.28.0-rc0

* start nodes with minFee

* updated snapshots

* fixed test

* updated denom specific test errors

* remove min fee for now

* fixed create-validator command

* fixed denoms in e2e tests

* fixed denom issues

* fixed all e2e tests

* fixed tx querying tests

* removed commented code

* increase timeout on balance check for delegation

* incremented timeout more

* implemented feedback

* fixed bug where the address is not present for the balance header at start

* added delegation to update balance

* increase timeout for balance check

* switched to depositor

* testing stake with wait
  • Loading branch information
faboweb authored and fedekunze committed Dec 13, 2018
1 parent a783ff4 commit 9eb45c6
Show file tree
Hide file tree
Showing 41 changed files with 241 additions and 241 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- [\#1681](https://github.com/cosmos/voyager/issues/1681) Governance: Fixed voting starting date @sabau
- [\#1690](https://github.com/cosmos/voyager/issues/1690) Governance: Fixed error messages for maxLength @sabau
- [\#1690](https://github.com/cosmos/voyager/issues/1690) Feedbacks when Amount is not between valid thresholds @sabau
- 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

Expand Down
11 changes: 7 additions & 4 deletions app/src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,13 @@ async function startLCD(home, nodeURL) {
])
logProcess(child, join(home, `lcd.log`))

child.stdout.once(`line`, async line => {
const certPath = /\(cert: "(.+?)"/.exec(line)[1]
resolve({ ca: fs.readFileSync(certPath, `utf8`), process: child })
lcdStarted = true
child.stdout.on(`line`, line => {
if (/\(cert: "(.+?)"/.test(line)) {
const certPath = /\(cert: "(.+?)"/.exec(line)[1]
resolve({ ca: fs.readFileSync(certPath, `utf8`), process: child })
lcdStarted = true
child.stdout.removeAllListeners(`line`)
}
})

child.stderr.on(`line`, error => {
Expand Down
2 changes: 1 addition & 1 deletion app/src/renderer/components/common/TmBalance.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<h2>{{ unbondedAtoms }}</h2>
</div>
</div>
<short-bech32 :address="user.address" />
<short-bech32 :address="user.address || ''" />
<div class="tabs">
<div
v-for="tab in tabs"
Expand Down
4 changes: 2 additions & 2 deletions app/src/renderer/components/governance/PageGovernance.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<modal-propose
v-if="showModalPropose"
:show-modal-propose.sync="showModalPropose"
:denom="bondingDenom.toLowerCase()"
:denom="bondingDenom"
@createProposal="propose"
/>
<router-view />
Expand Down Expand Up @@ -79,7 +79,7 @@ export default {
type,
initial_deposit: [
{
denom: this.bondingDenom.toLowerCase(),
denom: this.bondingDenom,
amount: String(amount)
}
],
Expand Down
8 changes: 4 additions & 4 deletions app/src/renderer/components/governance/PageProposal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
:show-modal-deposit.sync="showModalDeposit"
:proposal-id="proposalId"
:proposal-title="proposal.title"
:denom="bondingDenom.toLowerCase()"
:denom="bondingDenom"
@submitDeposit="deposit"
/>
<modal-vote
Expand Down Expand Up @@ -276,9 +276,9 @@ export default {
// TODO: get min deposit denom from gov params
this.$store.commit(`notify`, {
title: `Successful deposit!`,
body: `You have successfully deposited your ${this.bondingDenom.toLowerCase()}s on proposal #${
this.proposalId
}`
body: `You have successfully deposited your ${
this.bondingDenom
}s on proposal #${this.proposalId}`
})
} catch ({ message }) {
this.$store.commit(`notifyError`, {
Expand Down
4 changes: 3 additions & 1 deletion app/src/renderer/components/wallet/PageWallet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ export default {
[`desc`, `asc`]
)
if (this.filters.balances.search.visible) {
return list.filter(coin => includes(coin.denom.toLowerCase(), query))
return list.filter(coin =>
includes(JSON.stringify(coin).toLowerCase(), query.toLowerCase())
)
} else {
return list
}
Expand Down
23 changes: 8 additions & 15 deletions app/src/renderer/connectors/lcdClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ const Client = (axios, localLcdURL, remoteLcdURL) => {
},
txs: function(addr) {
return Promise.all([
req(`GET`, `/txs?tag=sender_bech32='${addr}'`, true)(),
req(`GET`, `/txs?tag=recipient_bech32='${addr}'`, true)()
req(`GET`, `/txs?sender=${addr}`, true)(),
req(`GET`, `/txs?recipient=${addr}`, true)()
]).then(([senderTxs, recipientTxs]) => [].concat(senderTxs, recipientTxs))
},
tx: argReq(`GET`, `/txs`, ``, true),
Expand Down Expand Up @@ -199,19 +199,12 @@ const Client = (axios, localLcdURL, remoteLcdURL) => {
return req(`POST`, `/gov/proposals/${proposalId}/deposits`, true)(data)
},
getGovernanceTxs: async function(address) {
let [depositerTxs, proposerTxs] = await Promise.all([
req(
`GET`,
`/txs?tag=action='submit-proposal'&tag=proposer='${address}'`,
true
)(),
req(
`GET`,
`/txs?tag=action='deposit'&tag=depositer='${address}'`,
true
)()
])
return depositerTxs.concat(proposerTxs)
return await Promise.all([
req(`GET`, `/txs?action=submit-proposal&proposer=${address}`, true)(),
req(`GET`, `/txs?action=deposit&depositor=${address}`, true)()
]).then(([depositorTxs, proposerTxs]) =>
[].concat(depositorTxs, proposerTxs)
)
}
}
}
Expand Down
72 changes: 36 additions & 36 deletions app/src/renderer/connectors/lcdClientMock.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ let state = {
amount: `2300`
},
{
denom: `steak`,
denom: `STAKE`,
amount: `1000`
}
],
Expand Down Expand Up @@ -135,7 +135,7 @@ let state = {
description: `This is a test proposal`,
initial_deposit: [
{
denom: `steak`,
denom: `STAKE`,
amount: `100`
}
]
Expand All @@ -155,11 +155,11 @@ let state = {
{
type: `cosmos-sdk/MsgDeposit`,
value: {
depositer: `cosmos15ky9du8a2wlstz6fpx3p4mqpjyrm5ctpesxxn9`,
depositor: `cosmos15ky9du8a2wlstz6fpx3p4mqpjyrm5ctpesxxn9`,
proposal_id: `1`,
amount: [
{
denom: `steak`,
denom: `STAKE`,
amount: `100`
}
]
Expand All @@ -180,7 +180,7 @@ let state = {
delegator_addr: addresses[0],
delegation: {
amount: `24`,
denom: `steak`
denom: `STAKE`
}
}
}
Expand Down Expand Up @@ -304,7 +304,7 @@ let state = {
stakingParameters: {
unbonding_time: `259200000000000`,
max_validators: 100,
bond_denom: `steak`
bond_denom: `STAKE`
},
governanceParameters: {
deposit: {
Expand Down Expand Up @@ -340,13 +340,13 @@ let state = {
description: `Proposal description`,
initial_deposit: [
{
denom: `steak`,
denom: `STAKE`,
amount: `100`
}
],
total_deposit: [
{
denom: `steak`,
denom: `STAKE`,
amount: `100`
}
],
Expand All @@ -369,13 +369,13 @@ let state = {
description: `custom text proposal description`,
initial_deposit: [
{
denom: `steak`,
denom: `STAKE`,
amount: `200`
}
],
total_deposit: [
{
denom: `steak`,
denom: `STAKE`,
amount: `200`
}
],
Expand All @@ -398,13 +398,13 @@ let state = {
description: `custom text proposal description`,
initial_deposit: [
{
denom: `steak`,
denom: `STAKE`,
amount: `20`
}
],
total_deposit: [
{
denom: `steak`,
denom: `STAKE`,
amount: `170`
}
],
Expand Down Expand Up @@ -493,24 +493,24 @@ let state = {
1: [
{
proposal_id: `1`,
depositer: validators[0],
depositor: validators[0],
amount: [
{
denom: `steak`,
denom: `STAKE`,
amount: `15`
},
{
denom: `steak`,
denom: `STAKE`,
amount: `5`
}
]
},
{
proposal_id: `1`,
depositer: validators[1],
depositor: validators[1],
amount: [
{
denom: `steak`,
denom: `STAKE`,
amount: `5`
}
]
Expand All @@ -519,10 +519,10 @@ let state = {
2: [
{
proposal_id: `2`,
depositer: validators[0],
depositor: validators[0],
amount: [
{
denom: `steak`,
denom: `STAKE`,
amount: `200`
}
]
Expand All @@ -531,20 +531,20 @@ let state = {
5: [
{
proposal_id: `5`,
depositer: validators[0],
depositor: validators[0],
amount: [
{
denom: `steak`,
denom: `STAKE`,
amount: `20`
}
]
},
{
proposal_id: `5`,
depositer: validators[1],
depositor: validators[1],
amount: [
{
denom: `steak`,
denom: `STAKE`,
amount: `150`
}
]
Expand All @@ -553,10 +553,10 @@ let state = {
6: [
{
proposal_id: `6`,
depositer: validators[0],
depositor: validators[0],
amount: [
{
denom: `steak`,
denom: `STAKE`,
amount: `100`
}
]
Expand Down Expand Up @@ -1035,7 +1035,7 @@ module.exports = {
results = await this.submitProposalDeposit({
base_req,
proposal_id,
depositer: proposer,
depositor: proposer,
amount: initial_deposit
})
// remove proposal from state if it fails
Expand All @@ -1056,13 +1056,13 @@ module.exports = {
},
async getProposalDeposit(proposalId, address) {
return state.deposits[proposalId].find(
deposit => deposit.depositer === address
deposit => deposit.depositor === address
)
},
async submitProposalDeposit({
proposal_id,
base_req: { name, sequence },
depositer,
depositor,
amount
}) {
let results = []
Expand Down Expand Up @@ -1098,7 +1098,7 @@ module.exports = {
let coin
let submittedDeposit = {
proposal_id,
depositer,
depositor,
amount
}

Expand All @@ -1116,7 +1116,7 @@ module.exports = {
return results
}

// update depositer's balance
// update depositor's balance
coinBalance.amount -= depositCoinAmt

// ============= TOTAL PROPOSAL's DEPOSIT =============
Expand All @@ -1134,15 +1134,15 @@ module.exports = {
}

// ============= USER'S DEPOSITS =============
// check if there's an existing deposit by the depositer
// check if there's an existing deposit by the depositor
let prevDeposit =
state.deposits[proposal_id] &&
state.deposits[proposal_id].find(
deposit => deposit.depositer === depositer
deposit => deposit.depositor === depositor
)

if (!prevDeposit) {
// if no previous deposit by the depositer, we add it to the existing deposits
// if no previous deposit by the depositor, we add it to the existing deposits
if (!state.deposits[proposal_id]) state.deposits[proposal_id] = []
state.deposits[proposal_id].push(submittedDeposit)
break // break since no need to iterate over other coins
Expand All @@ -1155,7 +1155,7 @@ module.exports = {
if (!prevDepCoin) {
prevDeposit.amount.push(coin)
} else {
// there's a previous deposit from the depositer with the same coin
// there's a previous deposit from the depositor with the same coin
let newAmt = parseInt(prevDepCoin.amount) + parseInt(coin.amount)
prevDepCoin.amount = String(newAmt)
}
Expand All @@ -1168,7 +1168,7 @@ module.exports = {
if (proposal.proposal_status === `DepositPeriod`) {
// TODO: get min deposit denom from gov params instead of stake params
let depositCoinAmt = proposal.total_deposit.find(coin => {
return coin.denom === `steak`
return coin.denom === `STAKE`
}).amount
// TODO: get min deposit amount from gov params
if (parseInt(depositCoinAmt) >= 10) {
Expand Down Expand Up @@ -1268,7 +1268,7 @@ module.exports = {
if (type === `cosmos-sdk/MsgSubmitProposal`) {
return tx.tx.value.msg[0].value.proposer === addr
} else if (type === `cosmos-sdk/MsgDeposit`) {
return tx.tx.value.msg[0].value.depositer === addr
return tx.tx.value.msg[0].value.depositor === addr
}

return false
Expand Down
2 changes: 1 addition & 1 deletion app/src/renderer/vuex/modules/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default () => {
? JSON.parse(process.env.PREVIEW)
: process.env.NODE_ENV === `development`,
// TODO: change to atom
bondingDenom: `Steak`,
bondingDenom: `STAKE`,
modals: {
error: { active: false },
help: { active: false },
Expand Down
Loading

0 comments on commit 9eb45c6

Please sign in to comment.