Skip to content

Commit

Permalink
feat: upgrade libs (#21)
Browse files Browse the repository at this point in the history
* feat: add ibc hooks

* feat: token factory integration as a module

* feat: github actions

* wip: fix lint and sec issues

* fix: linting

* fix: gosec

* feat: remove build from test coverage

* feat: remove redundant encoding config

* feat: remove start.sh

* feat: remove start.sh

* feat: feather connect

* feat: feather connection

* wip: connection module

* feat: query server

* wip: proto, swagger and connection

* wip: connection

* fix: params keystore

* fix: proto, swagger and token-factory urls

* fix: leveldb access

* feat: feather query server

* feat: refact module code and write tests

* feat: rename module

* feat: feather module with tests and codecs

* wip: integration tests

* feat: integration tests

* feat: make codecov report optional

* fix: comments and linting

* fix: ibctm app module and tests

* feat: remove mounting keystore

* feat: apply simulation suggestions

* feat: simulate on feather module height

* fix: ibc hooks instantiate order

* test: ibc-hooks

* wip: ibc hooks tests

* fix: ibc-hooks, alliance validator and remove logs

* chore: upgrade dependencies

* feat: upgrade libs to new versions

* fix: tokenfactory, remove unused funcs and ibc-hooks from ibc apps
  • Loading branch information
emidev98 authored Jul 20, 2023
1 parent be30e27 commit 722d954
Show file tree
Hide file tree
Showing 13 changed files with 136 additions and 1,520 deletions.
52 changes: 22 additions & 30 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ import (
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

ibchooks "github.com/cosmos/ibc-apps/modules/ibc-hooks/v7"
ibchookskeeper "github.com/cosmos/ibc-apps/modules/ibc-hooks/v7/keeper"
ibchookstypes "github.com/cosmos/ibc-apps/modules/ibc-hooks/v7/types"
ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts"
icacontrollerkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper"
icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"
Expand All @@ -132,9 +135,6 @@ import (
ibcporttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types"
ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
ibchooks "github.com/terra-money/feather-core/x/ibc-hooks"
ibchookskeeper "github.com/terra-money/feather-core/x/ibc-hooks/keeper"
ibchookstypes "github.com/terra-money/feather-core/x/ibc-hooks/types"

// Token Factory for sdk 47
"github.com/terra-money/feather-core/x/tokenfactory"
Expand Down Expand Up @@ -233,6 +233,22 @@ var (
alliance.AppModuleBasic{},
feather.AppModuleBasic{},
)

// module account permissions
maccPerms = map[string][]string{
authtypes.FeeCollectorName: nil,
distrtypes.ModuleName: nil,
icatypes.ModuleName: nil,
minttypes.ModuleName: {authtypes.Minter},
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
tokenfactorytypes.ModuleName: {authtypes.Minter, authtypes.Burner},
alliancetypes.ModuleName: {authtypes.Minter, authtypes.Burner},
alliancetypes.RewardsPoolName: nil,
nft.ModuleName: nil,
}
)

var (
Expand Down Expand Up @@ -352,14 +368,10 @@ func New(
cdc,
app.keys[authtypes.StoreKey],
authtypes.ProtoBaseAccount,
make(map[string][]string), // This will be populated by each module later
maccPerms,
AccountAddressPrefix,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)
defer func() { // TODO: Does deferring this even work?
app.AuthKeeper.GetModulePermissions()[authtypes.FeeCollectorName] = authtypes.NewPermissionsForAddress(authtypes.FeeCollectorName, nil) // This implicitly creates a module account
app.BankKeeper.GetBlockedAddresses()[authtypes.NewModuleAddress(authtypes.FeeCollectorName).String()] = true
}()
modules = append(modules, auth.NewAppModule(cdc, app.AuthKeeper, nil, nil))
simModules = append(simModules, auth.NewAppModule(cdc, app.AuthKeeper, authsim.RandomGenesisAccounts, nil))

Expand Down Expand Up @@ -454,10 +466,6 @@ func New(
// 'staking' module - depends on
// 1. 'auth'
// 2. 'bank'
app.AuthKeeper.GetModulePermissions()[stakingtypes.BondedPoolName] = authtypes.NewPermissionsForAddress(stakingtypes.BondedPoolName, []string{authtypes.Burner, authtypes.Staking})
app.BankKeeper.GetBlockedAddresses()[authtypes.NewModuleAddress(stakingtypes.BondedPoolName).String()] = true
app.AuthKeeper.GetModulePermissions()[stakingtypes.NotBondedPoolName] = authtypes.NewPermissionsForAddress(stakingtypes.NotBondedPoolName, []string{authtypes.Burner, authtypes.Staking})
app.BankKeeper.GetBlockedAddresses()[authtypes.NewModuleAddress(stakingtypes.NotBondedPoolName).String()] = true
app.keys[stakingtypes.StoreKey] = storetypes.NewKVStoreKey(stakingtypes.StoreKey)
app.StakingKeeper = stakingkeeper.NewKeeper(
cdc,
Expand All @@ -475,8 +483,6 @@ func New(
// 1. 'staking'
// 2. 'auth'
// 3. 'bank'
app.AuthKeeper.GetModulePermissions()[minttypes.ModuleName] = authtypes.NewPermissionsForAddress(minttypes.ModuleName, []string{authtypes.Minter})
app.BankKeeper.GetBlockedAddresses()[authtypes.NewModuleAddress(minttypes.ModuleName).String()] = true
app.keys[minttypes.StoreKey] = storetypes.NewKVStoreKey(minttypes.StoreKey)
app.MintKeeper = mintkeeper.NewKeeper(
cdc,
Expand All @@ -493,8 +499,6 @@ func New(
// 'nft' module - depends on
// 1. 'auth'
// 2. 'bank'
app.AuthKeeper.GetModulePermissions()[nft.ModuleName] = authtypes.NewPermissionsForAddress(nft.ModuleName, nil)
app.BankKeeper.GetBlockedAddresses()[authtypes.NewModuleAddress(nft.ModuleName).String()] = true
app.keys[nftkeeper.StoreKey] = storetypes.NewKVStoreKey(nftkeeper.StoreKey)
app.NftKeeper = nftkeeper.NewKeeper(
app.keys[nftkeeper.StoreKey],
Expand Down Expand Up @@ -535,7 +539,6 @@ func New(
// 1. 'auth'
// 2. 'bank'
// 3. 'staking'
app.AuthKeeper.GetModulePermissions()[govtypes.ModuleName] = authtypes.NewPermissionsForAddress(govtypes.ModuleName, []string{authtypes.Burner})
app.keys[govtypes.StoreKey] = storetypes.NewKVStoreKey(govtypes.StoreKey)
app.GovKeeper = *govkeeper.NewKeeper(
cdc,
Expand All @@ -559,8 +562,6 @@ func New(
// 2. 'bank'
// 3. 'staking'
// 4. 'gov'
app.AuthKeeper.GetModulePermissions()[distrtypes.ModuleName] = authtypes.NewPermissionsForAddress(distrtypes.ModuleName, nil)
app.BankKeeper.GetBlockedAddresses()[authtypes.NewModuleAddress(distrtypes.ModuleName).String()] = true
app.keys[distrtypes.StoreKey] = storetypes.NewKVStoreKey(distrtypes.StoreKey)
app.DistrKeeper = distrkeeper.NewKeeper(
cdc,
Expand Down Expand Up @@ -665,7 +666,6 @@ func New(
app.BankKeeper,
)
app.keys[ibcporttypes.StoreKey] = storetypes.NewKVStoreKey(ibcporttypes.StoreKey)
app.AuthKeeper.GetModulePermissions()[ibctransfertypes.ModuleName] = authtypes.NewPermissionsForAddress(ibcfeetypes.ModuleName, nil)
icaHostIBCModule := icahost.NewIBCModule(app.ICAHostKeeper)
icaHostStack := ibcfee.NewIBCMiddleware(icaHostIBCModule, app.IBCFeeKeeper)

Expand Down Expand Up @@ -693,8 +693,6 @@ func New(
// 2. 'auth'
// 3. 'bank'
// 4. 'capability'
app.AuthKeeper.GetModulePermissions()[ibctransfertypes.ModuleName] = authtypes.NewPermissionsForAddress(ibctransfertypes.ModuleName, []string{authtypes.Minter, authtypes.Burner})
app.BankKeeper.GetBlockedAddresses()[authtypes.NewModuleAddress(ibctransfertypes.ModuleName).String()] = true
app.keys[ibctransfertypes.StoreKey] = storetypes.NewKVStoreKey(ibctransfertypes.StoreKey)
app.TransferKeeper = ibctransferkeeper.NewKeeper(
cdc,
Expand Down Expand Up @@ -729,8 +727,6 @@ func New(
simModules = append(simModules, ibctransfer.NewAppModule(app.TransferKeeper))

// 'ica'
app.AuthKeeper.GetModulePermissions()[icatypes.ModuleName] = authtypes.NewPermissionsForAddress(icatypes.ModuleName, nil)
app.BankKeeper.GetBlockedAddresses()[authtypes.NewModuleAddress(icatypes.ModuleName).String()] = true

// 'icacontroller' module - depends on
// 1. 'ibc'
Expand Down Expand Up @@ -777,8 +773,6 @@ func New(
// 6. 'capability'
// 7. 'ibc'
// 8. 'ibctransfer'
app.AuthKeeper.GetModulePermissions()[wasmtypes.ModuleName] = authtypes.NewPermissionsForAddress(wasmtypes.ModuleName, []string{authtypes.Burner})
app.BankKeeper.GetBlockedAddresses()[authtypes.NewModuleAddress(wasmtypes.ModuleName).String()] = true
app.keys[wasmtypes.StoreKey] = storetypes.NewKVStoreKey(wasmtypes.StoreKey)
wasmConfig, err := wasm.ReadWasmConfig(appOpts)
if err != nil {
Expand All @@ -791,6 +785,7 @@ func New(
app.BankKeeper,
app.StakingKeeper,
distrkeeper.NewQuerier(app.DistrKeeper),
app.IBCFeeKeeper,
app.IBCKeeper.ChannelKeeper,
&app.IBCKeeper.PortKeeper,
app.CapabilityKeeper.ScopeToModule(wasm.ModuleName),
Expand Down Expand Up @@ -818,10 +813,6 @@ func New(
// 4. 'distribution'
// 5. 'gov'
app.BankKeeper.RegisterKeepers(app.AllianceKeeper, app.StakingKeeper)
app.AuthKeeper.GetModulePermissions()[tokenfactorytypes.ModuleName] = authtypes.NewPermissionsForAddress(tokenfactorytypes.ModuleName, []string{authtypes.Minter, authtypes.Burner})
app.AuthKeeper.GetModulePermissions()[alliancetypes.ModuleName] = authtypes.NewPermissionsForAddress(alliancetypes.ModuleName, []string{authtypes.Minter, authtypes.Burner})
app.AuthKeeper.GetModulePermissions()[alliancetypes.RewardsPoolName] = authtypes.NewPermissionsForAddress(alliancetypes.RewardsPoolName, nil)
app.BankKeeper.GetBlockedAddresses()[authtypes.NewModuleAddress(alliancetypes.RewardsPoolName).String()] = true
app.keys[alliancetypes.StoreKey] = storetypes.NewKVStoreKey(alliancetypes.StoreKey)
app.AllianceKeeper = alliancekeeper.NewKeeper(
cdc,
Expand All @@ -831,6 +822,7 @@ func New(
app.BankKeeper,
app.StakingKeeper,
app.DistrKeeper,
authtypes.FeeCollectorName,
)
govLegacyRouter.AddRoute(alliancetypes.RouterKey, alliance.NewAllianceProposalHandler(app.AllianceKeeper))
stakingHooks = append(stakingHooks, app.AllianceKeeper.StakingHooks())
Expand Down
66 changes: 35 additions & 31 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,40 @@ module github.com/terra-money/feather-core
go 1.20

require (
cosmossdk.io/errors v1.0.0-beta.7
cosmossdk.io/errors v1.0.0
cosmossdk.io/math v1.0.1
github.com/CosmWasm/wasmd v0.40.0-rc.1
github.com/CosmWasm/wasmvm v1.2.3
github.com/cometbft/cometbft v0.37.1
github.com/cometbft/cometbft-db v0.7.0
github.com/CosmWasm/wasmd v0.40.2
github.com/CosmWasm/wasmvm v1.2.4
github.com/cometbft/cometbft v0.37.2
github.com/cometbft/cometbft-db v0.8.0
github.com/cosmos/cosmos-proto v1.0.0-beta.3
github.com/cosmos/cosmos-sdk v0.47.3
github.com/cosmos/cosmos-sdk v0.47.4
github.com/cosmos/gogoproto v1.4.10
github.com/cosmos/ibc-apps/modules/ibc-hooks/v7 v7.0.0-20230714185117-ff99bd994f22
github.com/cosmos/ibc-go/v7 v7.1.0
github.com/golang/protobuf v1.5.3
github.com/gorilla/mux v1.8.0
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/prometheus/client_golang v1.15.0
github.com/spf13/cast v1.5.0
github.com/spf13/cast v1.5.1
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.2
github.com/terra-money/alliance v0.2.0-rc.1
google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4
google.golang.org/grpc v1.55.0
github.com/stretchr/testify v1.8.4
github.com/terra-money/alliance v0.2.3
google.golang.org/genproto/googleapis/api v0.0.0-20230629202037-9506855d4529
google.golang.org/grpc v1.56.2
)

require (
cloud.google.com/go v0.110.0 // indirect
cloud.google.com/go/compute v1.18.0 // indirect
cloud.google.com/go v0.110.4 // indirect
cloud.google.com/go/compute v1.20.1 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v0.12.0 // indirect
cloud.google.com/go/storage v1.29.0 // indirect
cloud.google.com/go/iam v1.1.0 // indirect
cloud.google.com/go/storage v1.30.1 // indirect
cosmossdk.io/api v0.3.1 // indirect
cosmossdk.io/core v0.6.1 // indirect
cosmossdk.io/depinject v1.0.0-alpha.3 // indirect
cosmossdk.io/log v1.1.0 // indirect
cosmossdk.io/log v1.1.1-0.20230704160919-88f2c830b0ca // indirect
cosmossdk.io/tools/rosetta v0.2.1 // indirect
filippo.io/edwards25519 v1.0.0 // indirect
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
Expand Down Expand Up @@ -69,7 +70,7 @@ require (
github.com/dgraph-io/badger/v2 v2.2007.4 // indirect
github.com/dgraph-io/ristretto v0.1.1 // indirect
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
github.com/docker/distribution v2.8.1+incompatible // indirect
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/dvsekhvalnov/jose2go v1.5.0 // indirect
github.com/felixge/httpsnoop v1.0.2 // indirect
Expand All @@ -88,9 +89,10 @@ require (
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/orderedcode v0.0.1 // indirect
github.com/google/s2a-go v0.1.4 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
github.com/googleapis/gax-go/v2 v2.7.0 // indirect
github.com/googleapis/gax-go/v2 v2.11.0 // indirect
github.com/gorilla/handlers v1.5.1 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
Expand All @@ -113,10 +115,11 @@ require (
github.com/klauspost/compress v1.16.3 // indirect
github.com/lib/pq v1.10.7 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/linxGnu/grocksdb v1.7.16 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/manifoldco/promptui v0.9.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.18 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect
github.com/minio/highwayhash v1.0.2 // indirect
Expand All @@ -125,7 +128,7 @@ require (
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mtibben/percent v0.2.1 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/pelletier/go-toml/v2 v2.0.7 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
Expand All @@ -137,30 +140,31 @@ require (
github.com/rs/cors v1.8.3 // indirect
github.com/rs/zerolog v1.29.1 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/spf13/afero v1.9.3 // indirect
github.com/spf13/afero v1.9.5 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/viper v1.15.0 // indirect
github.com/spf13/viper v1.16.0 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect
github.com/tendermint/go-amino v0.16.0 // indirect
github.com/tidwall/btree v1.6.0 // indirect
github.com/ulikunitz/xz v0.5.11 // indirect
github.com/zondax/hid v0.9.1 // indirect
github.com/zondax/ledger-go v0.14.1 // indirect
go.etcd.io/bbolt v1.3.7 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/crypto v0.8.0 // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect
golang.org/x/net v0.9.0 // indirect
golang.org/x/oauth2 v0.6.0 // indirect
golang.org/x/sys v0.7.0 // indirect
golang.org/x/term v0.7.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/net v0.12.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/term v0.10.0 // indirect
golang.org/x/text v0.11.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.110.0 // indirect
google.golang.org/api v0.126.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.30.0 // indirect
google.golang.org/genproto v0.0.0-20230706204954-ccb25ca9f130 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading

0 comments on commit 722d954

Please sign in to comment.