Skip to content

Commit

Permalink
release (#328)
Browse files Browse the repository at this point in the history
* Fabo/fix gas (#250)

* fix gas estimate

* linted

* fixed test

* do not keep data sources (#251)

* track failing transactions in Sentry (#249)

* correctly set the tx schema for a failing tx (#248)

* Fabo/remove per block caching as not working (#247)

* remove per block caching as not working

* fix memoized results

Co-authored-by: Ana G. <[email protected]>

* delete perblockcachedatasource (#253)

* Ana/fix balances in actionmodal (#255)

* fix action modal available balance

* include regen

* use dictionary for denomlookup

* use correct events for received txs (#257)

* enable account creation for some networks (#252)

* network update time metric added (#256)

* network update time metric added

* added missing dep

Co-authored-by: Fabian <[email protected]>

* Fix proposal deposit (#261)

* Remove denom handling from getDeposit()

* Revert undesired change

* delete package-lock.json

* localtestnet config change (#265)

* Ana/handle "address not from this network" error (#263)

* add check address function for all queries

* apply suggestions

* Ana/add fiatvalue to balances query (e-Money) (#262)

* preparation

* more preparation

* add fiatvalue field to balances query

* fix get account info

* apply suggestions

* apply one last suggestion

* suggestions+

Co-authored-by: Fabian <[email protected]>

* Ana/emoney fix expected returns with inflation and totalbacked (#243)

* fix expected returns with inflation and supply

* minor fixes. dictionary

* query exchange rates from emoney api

* fix infinite expected returns

* convert api url to const

* add eur value to totalbackedvalue. totalngm gains

* add important comment

* finish calculation

* lint

* catch errors with sentry

Co-authored-by: Fabian <[email protected]>

* readd coin conversion (#268)

* delete amount field (#274)

* Fabo/increase gas again (#271)

* icrease gas again

* fixed test

* Fabo/load all txs (even if more then first page in response) (#270)

* load all txs (even if more then first page in response)

* improved handling of txs

* missing renaming

* fixed paginated load

* add pagination fix also to cosmosV0-source

Co-authored-by: iambeone <[email protected]>
Co-authored-by: Ana G. <[email protected]>

* fixing issue with multiple senders in one event (#273)

* fixing issue with multiple senders in one event

* Update lib/source/cosmosV2-source.js

Co-authored-by: Fabian <[email protected]>

* Fabo/allow signing for terra + emoney (#267)

* allow signing for terra

* readd coin conversion

* enable actions for terra

* fix correct terra testnet url

* comments and guards

* enabled more txs for emoney and fixed broadcasting

* added a catch for wrongly formatted broadcast urls

* recover default field. change some network titles (#277)

* Fabo/add network data to API (#278)

* non desctructive introduction of better address prefix wording

* added address creator to API

* adjusted test

* added ledger app to networks config

* add icon property to schema (#281)

* add icon property to schema

* fix network schema validation

Co-authored-by: Ana G. <[email protected]>

* filter out validator specific txs (#279)

* Ana/balances coinreducer good fix (#269)

* balances coinreducer good fix

* refactored fiat value logic

Co-authored-by: Fabian <[email protected]>

* Create network_integration.md

* Update network_integration.md

* Update network_integration.md

* Fabo/avoid 500 errors (#288)

* avoid using the latest query

* cleanup

* Ana/filter validator tx cross network and add txvalue reducer (#285)

* filter validators cross network

* add value reducer. necessary for multi claim txs

* add validator txs filter also for cosmosv0 source

* filter and make array only claim rewards msg value

* filter txs by whitelist

* change length in multi claim reward reducer

* add withdrawvalidators

* replace dictionary for set

* refactor transaction snippet. avoid repetition

* Ana/emoney upgrade (mergeable) (#282)

* update emoney api_url

* fix denom. add default fiat currency

* fix rpc endpoint

* fix value (my bad) (#293)

* fix value (my bad)

* trigger another ci flow

* erase space

* set correct new chain id (#294)

* restart API

* restart API

* fix pr alert (#297)

* Fabo/298 tendermint reconnect (#300)

* reconnect on tendermint disconnect

* cleanup

* comments

* Update cosmos-node-subscription.js

* Fabo/299 trigger a chain hangup error (#301)

* trigger a chain hangup error

* increase chain hangup time

* Apply suggestions from code review

* Fabo/store validator addresses (#296)

* add validator addresses to db

* linted

* ignore in local dev

* revert

* fixed fetch

* comment

* refactored db into constructor

* cleanup

* add clearTimeout to avoid reconnection hell (#306)

* add clearTimeout to avoid reconnection hell

* removed console.log

* Aleksei/luniedb replaced (#303)

* add validator addresses to db

* linted

* ignore in local dev

* revert

* fixed fetch

* comment

* refactored db into constructor

* cleanup

* replaced luniedb

* linted

Co-authored-by: Fabian <[email protected]>

* disable reconnection logic

* clear polling interval for tendermint connection

* simple api fixes (#310)

* Fabo/remove tendermint (#311)

* remove tendermint

*  fixed empty blockHeight issue

* small refactoring

* catch on fetches to get logging

* delay block updates

* add retry logic

* refactored getBlockByHeight

* remove pm2 dep

* validator profiles were returned as array (#312)

* remove pr github action (#316)

* fixing caching issue and more (#315)

* fixing caching issue and more

* clear chain hangup timeout

* timeout fixed

* Update lib/block-listeners/cosmos-node-subscription.js

Co-authored-by: Jordan Bibla <[email protected]>

* added terra_mainnet to networks (#309)

* added terra_mainnet to networks

* errors fix reverted

* Ana/add multidenom rewards. necessary for emoney (#308)

* add multidenom rewards. necessary for emoney

* add rewards to overview. improve code location

* lint

* add filter rewards for multidenom

* important fix

* another important fix

* fix cannot read propery constructor of undefined (#318)

* change terra mainnet title

* pushing something to trigger new build and to restart the node

* trying out nylira's node

* WIP: Ana/More Terra fixes (#323)

* fixing my mess

* move all rewards logic to terra

* clearly signal single denom rewards

* Revert "WIP: Ana/More Terra fixes (#323)" (#325)

This reverts commit 408186a.

* catch inside block polling function (#327)

* Fabo/disable writing validator addresses for now (#329)

* disable writing validator addresses for now

* linted

Co-authored-by: Ana G. <[email protected]>
Co-authored-by: Aleksey Rudometov <[email protected]>
Co-authored-by: Mario Pino <[email protected]>
Co-authored-by: Jordan Bibla <[email protected]>
  • Loading branch information
5 people authored Feb 15, 2020
1 parent d601c2c commit eb5beaf
Showing 1 changed file with 47 additions and 33 deletions.
80 changes: 47 additions & 33 deletions lib/block-listeners/cosmos-node-subscription.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,14 @@ class CosmosNodeSubscription {

async pollForNewBlock() {
this.pollingTimeout = setTimeout(async () => {
const block = await this.cosmosAPI.getBlockByHeight()
if (this.height !== block.height) {
let block
try {
block = await this.cosmosAPI.getBlockByHeight()
} catch (error) {
console.error('Failed to fetch block for subscription', error)
Sentry.captureException(error)
}
if (block && this.height !== block.height) {
// apparently the cosmos db takes a while to serve the content after a block has been updated
// if we don't do this, we run into errors as the data is not yet available
setTimeout(() => this.newBlockHandler(block), COSMOS_DB_DELAY)
Expand Down Expand Up @@ -61,41 +67,49 @@ class CosmosNodeSubscription {
// A GraphQL resolver is listening for these messages and sends the block to
// each subscribed user.
async newBlockHandler(block) {
Sentry.configureScope(function(scope) {
scope.setExtra('height', block.height)
})
try {
Sentry.configureScope(function(scope) {
scope.setExtra('height', block.height)
})

const validators = await this.cosmosAPI.getAllValidators(block.height)
const validatorMap = await this.getValidatorMap(validators)
this.updateDBValidatorProfiles(validators)
this.store.update({ height: block.height, block, validators: validatorMap })
publishBlockAdded(this.network.id, block)
// TODO remove, only for demo purposes
// publishEvent(this.network.id, 'block', '', block)
const validators = await this.cosmosAPI.getAllValidators(block.height)
const validatorMap = await this.getValidatorMap(validators)
// this.updateDBValidatorProfiles(validators)
this.store.update({
height: block.height,
block,
validators: validatorMap
})
publishBlockAdded(this.network.id, block)
// TODO remove, only for demo purposes
// publishEvent(this.network.id, 'block', '', block)

// For each transaction listed in a block we extract the relevant addresses. This is published to the network.
// A GraphQL resolver is listening for these messages and sends the
// transaction to each subscribed user.
// TODO doesn't handle failing txs as it doesn't extract addresses from those txs (they are not tagged)
block.transactions.forEach(tx => {
let addresses = []
try {
this.cosmosAPI.extractInvolvedAddresses(tx.raw).forEach(address => {
addresses.push(address)
})
} catch (err) {
Sentry.withScope(function(scope) {
scope.setExtra('transaction', tx.raw)
Sentry.captureException(err)
// For each transaction listed in a block we extract the relevant addresses. This is published to the network.
// A GraphQL resolver is listening for these messages and sends the
// transaction to each subscribed user.
// TODO doesn't handle failing txs as it doesn't extract addresses from those txs (they are not tagged)
block.transactions.forEach(tx => {
let addresses = []
try {
this.cosmosAPI.extractInvolvedAddresses(tx.raw).forEach(address => {
addresses.push(address)
})
} catch (err) {
Sentry.withScope(function(scope) {
scope.setExtra('transaction', tx.raw)
Sentry.captureException(err)
})
}
addresses = _.uniq(addresses)
addresses.forEach(address => {
publishUserTransactionAdded(this.network.id, address, tx)
publishEvent(this.network.id, 'transaction', address, tx)
})
}
addresses = _.uniq(addresses)
addresses.forEach(address => {
publishUserTransactionAdded(this.network.id, address, tx)
publishEvent(this.network.id, 'transaction', address, tx)
})
})

} catch (error) {
console.error('newBlockHandler failed')
Sentry.captureException(error)
}
this.cosmosAPI.memoizedResults.clear()
}

Expand Down

0 comments on commit eb5beaf

Please sign in to comment.