Skip to content

Commit

Permalink
Merge branch 'cosmos/v0.44.x' into aaron/parse_proposal_latest_status
Browse files Browse the repository at this point in the history
  • Loading branch information
RiccardoM authored May 31, 2022
2 parents c955b4c + 7d7337c commit 4c1c434
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 599 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v4.4.0
- uses: amannn/action-semantic-pull-request@v4.5.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
.go
.mod
.sum
- uses: golangci/golangci-lint-action@v3.1.0
- uses: golangci/golangci-lint-action@v3.2.0
with:
version: v1.28
args: --timeout 10m
Expand Down
13 changes: 10 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## Unreleased
### Changes
#### Gov module
- ([\#401](https://github.com/forbole/bdjuno/pull/401)) Update the proposal status to the latest in `bdjuno parse gov proposal [id]` command

### Dependencies
- ([\#412](https://github.com/forbole/bdjuno/pull/412)) Updated Juno to `v3.2.1`

## Version v3.1.0
### Dependencies
- Updated Juno to `v3.2.0`
Expand All @@ -6,9 +14,8 @@
#### Hasura
- ([\#395](https://github.com/forbole/bdjuno/pull/395)) Remove time label from Hasura Prometheus monitoring

#### Parse `x/gov`
- ([\#401](https://github.com/forbole/bdjuno/pull/401)) Update the proposal status to the latest in `bdjuno parse gov proposal [id]` command

#### Bank module
- ([\#410](https://github.com/forbole/bdjuno/pull/410)) Change total supply query from only 1 page to all pages

## Version v3.0.1
### Dependencies
Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ module github.com/forbole/bdjuno/v3
go 1.17

require (
github.com/cosmos/cosmos-sdk v0.45.3
github.com/cosmos/gaia/v7 v7.0.1
github.com/forbole/juno/v3 v3.2.0
github.com/cosmos/cosmos-sdk v0.45.4
github.com/cosmos/gaia/v7 v7.0.2
github.com/forbole/juno/v3 v3.2.1
github.com/go-co-op/gocron v1.13.0
github.com/gogo/protobuf v1.3.3
github.com/jmoiron/sqlx v1.3.5
github.com/lib/pq v1.10.5
github.com/lib/pq v1.10.6
github.com/pelletier/go-toml v1.9.5
github.com/prometheus/client_golang v1.12.1
github.com/prometheus/client_golang v1.12.2
github.com/proullon/ramsql v0.0.0-20181213202341-817cee58a244
github.com/rs/zerolog v1.26.1
github.com/spf13/cobra v1.4.0
Expand Down
590 changes: 10 additions & 580 deletions go.sum

Large diffs are not rendered by default.

27 changes: 22 additions & 5 deletions modules/bank/source/local/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package local
import (
"fmt"

"github.com/cosmos/cosmos-sdk/types/query"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"

sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -50,19 +51,35 @@ func (s Source) GetBalances(addresses []string, height int64) ([]types.AccountBa
return balances, nil
}

// GetSupply implements keeper.Source
// GetSupply implements bankkeeper.Source
func (s Source) GetSupply(height int64) (sdk.Coins, error) {
ctx, err := s.LoadHeight(height)
if err != nil {
return nil, fmt.Errorf("error while loading height: %s", err)
}

res, err := s.q.TotalSupply(sdk.WrapSDKContext(ctx), &banktypes.QueryTotalSupplyRequest{})
if err != nil {
return nil, err
var coins []sdk.Coin
var nextKey []byte
var stop = false
for !stop {
res, err := s.q.TotalSupply(
sdk.WrapSDKContext(ctx),
&banktypes.QueryTotalSupplyRequest{
Pagination: &query.PageRequest{
Key: nextKey,
Limit: 100, // Query 100 supplies at time
},
})
if err != nil {
return nil, fmt.Errorf("error while getting total supply: %s", err)
}

nextKey = res.Pagination.NextKey
stop = len(res.Pagination.NextKey) == 0
coins = append(coins, res.Supply...)
}

return res.Supply, nil
return coins, nil
}

// GetAccountBalances implements bankkeeper.Source
Expand Down
27 changes: 23 additions & 4 deletions modules/bank/source/remote/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/query"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/forbole/juno/v3/node/remote"

Expand Down Expand Up @@ -51,10 +52,28 @@ func (s Source) GetBalances(addresses []string, height int64) ([]types.AccountBa

// GetSupply implements bankkeeper.Source
func (s Source) GetSupply(height int64) (sdk.Coins, error) {
res, err := s.bankClient.TotalSupply(remote.GetHeightRequestContext(s.Ctx, height), &banktypes.QueryTotalSupplyRequest{})
if err != nil {
return nil, fmt.Errorf("error while getting total supply: %s", err)
ctx := remote.GetHeightRequestContext(s.Ctx, height)

var coins []sdk.Coin
var nextKey []byte
var stop = false
for !stop {
res, err := s.bankClient.TotalSupply(
ctx,
&banktypes.QueryTotalSupplyRequest{
Pagination: &query.PageRequest{
Key: nextKey,
Limit: 100, // Query 100 supplies at time
},
})
if err != nil {
return nil, fmt.Errorf("error while getting total supply: %s", err)
}

nextKey = res.Pagination.NextKey
stop = len(res.Pagination.NextKey) == 0
coins = append(coins, res.Supply...)
}

return res.Supply, nil
return coins, nil
}

0 comments on commit 4c1c434

Please sign in to comment.