EmerisHQ / demeris-backend

Monorepo containing all the Demeris backend code and infrastructure definitions.
GNU Affero General Public License v3.0
8 stars 1 forks source link

Make '/cached/cosmos/bank/v1beta1/supply' endpoint more reliable #402

Closed sgerogia closed 2 years ago

sgerogia commented 2 years ago

The current version of the cached/cosmos/bank/v1beta1/supply endpoint is a cached version (i.e. approximation) of the original value (liquidity/cosmos/bank/v1beta1/supply)

The current int. test takes a simple approach of comparing the 2 endpoints 1-to-1. Due to timing and other factors, this always fails.

We need a better way of identifying if the cached endpoint returns the wrong results (i.e. it has not been updated in a while).

Some initial thoughts to start the investigation:

CC @gamarin2 for comments

0xmuralik commented 2 years ago

As we can't query for supply at a certain height, going with the second approach seems better. Considering cosmos-hub inflation as 14% i.e. 0.038% per day, for the cached endpoint to be reliable enough that the supply difference isn't more than one day's minted tokens, supply/cachedSupply should not be greater than 1.00038 Inflation can be fetched from /liquidity/cosmos/mint/v1beta1/inflation CC: @gamarin2