Skip to content

Commit

Permalink
bump dependencies && add fetchprice ibc module
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 committed Jan 16, 2024
1 parent 8fb7853 commit 44403e7
Show file tree
Hide file tree
Showing 6 changed files with 190 additions and 146 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM golang:1.21-alpine AS go-builder
#ARG arch=x86_64

# See https://github.com/initia-labs/initiavm/releases
ENV LIBINITIAVM_VERSION=v0.1.2-beta.5
ENV LIBINITIAVM_VERSION=v0.1.2-beta.9

# this comes from standard alpine nightly file
# https://github.com/rust-lang/docker-rust-nightly/blob/master/alpine3.12/Dockerfile
Expand Down
1 change: 0 additions & 1 deletion app/ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
anteDecorators := []sdk.AnteDecorator{
ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker),
moveante.NewSimulationFlagDecorator(),
moveante.NewGasPricesDecorator(),
ante.NewValidateBasicDecorator(),
ante.NewTxTimeoutHeightDecorator(),
Expand Down
107 changes: 78 additions & 29 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import (
cosmosante "github.com/cosmos/cosmos-sdk/x/auth/ante"
authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
"github.com/cosmos/cosmos-sdk/x/auth/posthandler"
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/authz"
Expand Down Expand Up @@ -110,6 +111,11 @@ import (
movekeeper "github.com/initia-labs/initia/x/move/keeper"
movetypes "github.com/initia-labs/initia/x/move/types"

"github.com/initia-labs/initia/x/ibc/fetchprice"
fetchpriceconsumer "github.com/initia-labs/initia/x/ibc/fetchprice/consumer"
fetchpriceconsumerkeeper "github.com/initia-labs/initia/x/ibc/fetchprice/consumer/keeper"
fetchpriceconsumertypes "github.com/initia-labs/initia/x/ibc/fetchprice/consumer/types"
fetchpricetypes "github.com/initia-labs/initia/x/ibc/fetchprice/types"
moveibcmiddleware "github.com/initia-labs/initia/x/move/ibc-middleware"

opchild "github.com/initia-labs/OPinit/x/opchild"
Expand Down Expand Up @@ -186,33 +192,34 @@ type MinitiaApp struct {
memKeys map[string]*storetypes.MemoryStoreKey

// keepers
AccountKeeper *authkeeper.AccountKeeper
BankKeeper *bankkeeper.BaseKeeper
CapabilityKeeper *capabilitykeeper.Keeper
UpgradeKeeper *upgradekeeper.Keeper
GroupKeeper *groupkeeper.Keeper
ConsensusParamsKeeper *consensusparamkeeper.Keeper
IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
TransferKeeper *ibctransferkeeper.Keeper
NftTransferKeeper *ibcnfttransferkeeper.Keeper
AuthzKeeper *authzkeeper.Keeper
FeeGrantKeeper *feegrantkeeper.Keeper
ICAHostKeeper *icahostkeeper.Keeper
ICAControllerKeeper *icacontrollerkeeper.Keeper
ICAAuthKeeper *icaauthkeeper.Keeper
IBCFeeKeeper *ibcfeekeeper.Keeper
MoveKeeper *movekeeper.Keeper
OPChildKeeper *opchildkeeper.Keeper
AuctionKeeper *auctionkeeper.Keeper // x/auction keeper used to process bids for TOB auctions
AccountKeeper *authkeeper.AccountKeeper
BankKeeper *bankkeeper.BaseKeeper
CapabilityKeeper *capabilitykeeper.Keeper
UpgradeKeeper *upgradekeeper.Keeper
GroupKeeper *groupkeeper.Keeper
ConsensusParamsKeeper *consensusparamkeeper.Keeper
IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
TransferKeeper *ibctransferkeeper.Keeper
NftTransferKeeper *ibcnfttransferkeeper.Keeper
AuthzKeeper *authzkeeper.Keeper
FeeGrantKeeper *feegrantkeeper.Keeper
ICAHostKeeper *icahostkeeper.Keeper
ICAControllerKeeper *icacontrollerkeeper.Keeper
ICAAuthKeeper *icaauthkeeper.Keeper
IBCFeeKeeper *ibcfeekeeper.Keeper
MoveKeeper *movekeeper.Keeper
OPChildKeeper *opchildkeeper.Keeper
AuctionKeeper *auctionkeeper.Keeper // x/auction keeper used to process bids for TOB auctions
FetchPriceConsumerKeeper *fetchpriceconsumerkeeper.Keeper

// make scoped keepers public for test purposes
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
ScopedTransferKeeper capabilitykeeper.ScopedKeeper
ScopedNftTransferKeeper capabilitykeeper.ScopedKeeper
ScopedSftTransferKeeper capabilitykeeper.ScopedKeeper
ScopedICAHostKeeper capabilitykeeper.ScopedKeeper
ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper
ScopedICAAuthKeeper capabilitykeeper.ScopedKeeper
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
ScopedTransferKeeper capabilitykeeper.ScopedKeeper
ScopedNftTransferKeeper capabilitykeeper.ScopedKeeper
ScopedICAHostKeeper capabilitykeeper.ScopedKeeper
ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper
ScopedICAAuthKeeper capabilitykeeper.ScopedKeeper
ScopedFetchPriceConsumerKeeper capabilitykeeper.ScopedKeeper

// the module manager
ModuleManager *module.Manager
Expand Down Expand Up @@ -256,7 +263,7 @@ func NewMinitiaApp(
ibcnfttransfertypes.StoreKey, capabilitytypes.StoreKey, authzkeeper.StoreKey,
feegrant.StoreKey, icahosttypes.StoreKey, icacontrollertypes.StoreKey,
icaauthtypes.StoreKey, ibcfeetypes.StoreKey, movetypes.StoreKey,
opchildtypes.StoreKey, auctiontypes.StoreKey,
opchildtypes.StoreKey, auctiontypes.StoreKey, fetchpriceconsumertypes.StoreKey,
)
tkeys := storetypes.NewTransientStoreKeys()
memKeys := storetypes.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
Expand Down Expand Up @@ -301,6 +308,7 @@ func NewMinitiaApp(
scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName)
scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName)
scopedICAAuthKeeper := app.CapabilityKeeper.ScopeToModule(icaauthtypes.ModuleName)
scopedFetchPriceConsumerKeeper := app.CapabilityKeeper.ScopeToModule(fetchpriceconsumertypes.SubModuleName)

app.CapabilityKeeper.Seal()

Expand Down Expand Up @@ -533,6 +541,33 @@ func NewMinitiaApp(
icaControllerStack = ibcfee.NewIBCMiddleware(icaControllerIBCModule, *app.IBCFeeKeeper)
}

///////////////////////////////////////
// fetchprice provider configuration //
///////////////////////////////////////
var fetchpriceConsumerStack porttypes.IBCModule
{
app.FetchPriceConsumerKeeper = fetchpriceconsumerkeeper.NewKeeper(
appCodec,
runtime.NewKVStoreService(keys[fetchpriceconsumertypes.StoreKey]),
ac,
// ics4wrapper: fetchprice consumer -> fee
app.IBCFeeKeeper,
app.IBCKeeper.ChannelKeeper,
app.IBCKeeper.PortKeeper,
scopedFetchPriceConsumerKeeper,
)

fetchpriceConsumerModule := fetchpriceconsumer.NewIBCModule(
appCodec,
*app.FetchPriceConsumerKeeper,
)
fetchpriceConsumerStack = ibcfee.NewIBCMiddleware(
// receive: fee -> fetchprice consumer
fetchpriceConsumerModule,
*app.IBCFeeKeeper,
)
}

//////////////////////////////
// IBC router Configuration //
//////////////////////////////
Expand All @@ -543,7 +578,8 @@ func NewMinitiaApp(
AddRoute(icahosttypes.SubModuleName, icaHostStack).
AddRoute(icacontrollertypes.SubModuleName, icaControllerStack).
AddRoute(icaauthtypes.ModuleName, icaControllerStack).
AddRoute(ibcnfttransfertypes.ModuleName, nftTransferStack)
AddRoute(ibcnfttransfertypes.ModuleName, nftTransferStack).
AddRoute(fetchpriceconsumertypes.SubModuleName, fetchpriceConsumerStack)

app.IBCKeeper.SetRouter(ibcRouter)

Expand Down Expand Up @@ -613,6 +649,7 @@ func NewMinitiaApp(
ibcfee.NewAppModule(*app.IBCFeeKeeper),
ibctm.NewAppModule(),
solomachine.NewAppModule(),
fetchprice.NewAppModule(appCodec, app.FetchPriceConsumerKeeper, nil),
)

// BasicModuleManager defines the module BasicManager is in charge of setting up basic,
Expand Down Expand Up @@ -661,7 +698,7 @@ func NewMinitiaApp(
opchildtypes.ModuleName, genutiltypes.ModuleName, authz.ModuleName, group.ModuleName,
upgradetypes.ModuleName, feegrant.ModuleName, consensusparamtypes.ModuleName, ibcexported.ModuleName,
ibctransfertypes.ModuleName, ibcnfttransfertypes.ModuleName, icatypes.ModuleName, icaauthtypes.ModuleName,
ibcfeetypes.ModuleName, consensusparamtypes.ModuleName, auctiontypes.ModuleName,
ibcfeetypes.ModuleName, consensusparamtypes.ModuleName, auctiontypes.ModuleName, fetchpricetypes.ModuleName,
}

app.ModuleManager.SetOrderInitGenesis(genesisModuleOrder...)
Expand Down Expand Up @@ -696,7 +733,7 @@ func NewMinitiaApp(
app.SetInitChainer(app.InitChainer)
app.SetPreBlocker(app.PreBlocker)
app.SetBeginBlocker(app.BeginBlocker)
app.SetPostHandler(app.MoveKeeper.GetPostHandler())
app.setPostHandler()
app.SetEndBlocker(app.EndBlocker)

// initialize and set the InitiaApp mempool. The current mempool will be the
Expand Down Expand Up @@ -796,6 +833,7 @@ func NewMinitiaApp(
app.ScopedICAHostKeeper = scopedICAHostKeeper
app.ScopedICAControllerKeeper = scopedICAControllerKeeper
app.ScopedICAAuthKeeper = scopedICAAuthKeeper
app.ScopedFetchPriceConsumerKeeper = scopedFetchPriceConsumerKeeper

return app
}
Expand Down Expand Up @@ -842,6 +880,17 @@ func (app *MinitiaApp) setAnteHandler(
return anteHandler
}

func (app *MinitiaApp) setPostHandler() {
postHandler, err := posthandler.NewPostHandler(
posthandler.HandlerOptions{},
)
if err != nil {
panic(err)
}

app.SetPostHandler(postHandler)
}

// Name returns the name of the App
func (app *MinitiaApp) Name() string { return app.BaseApp.Name() }

Expand Down
64 changes: 34 additions & 30 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,26 @@ require (
github.com/golang/mock v1.6.0
github.com/gorilla/mux v1.8.1
github.com/initia-labs/OPinit v0.2.0-beta.1
github.com/initia-labs/initia v0.2.0-beta.1
github.com/initia-labs/initia v0.2.0-beta.2
// we also need to update `LIBINITIAVM_VERSION` of images/private/Dockerfile#5
github.com/initia-labs/initiavm v0.1.2-beta.8
github.com/initia-labs/initiavm v0.1.2-beta.9
github.com/pkg/errors v0.9.1
github.com/rakyll/statik v0.1.7
github.com/skip-mev/block-sdk v0.0.0-20231213233341-deceeb0e993b
github.com/spf13/cast v1.5.1
github.com/spf13/cast v1.6.0
github.com/spf13/cobra v1.8.0
github.com/spf13/viper v1.17.0
github.com/spf13/viper v1.18.2
github.com/stretchr/testify v1.8.4
)

require cosmossdk.io/tools/confix v0.1.1

require (
cloud.google.com/go v0.110.9 // indirect
cloud.google.com/go/compute v1.23.2 // indirect
cloud.google.com/go v0.110.10 // indirect
cloud.google.com/go/compute v1.23.3 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v1.1.4 // indirect
cloud.google.com/go/storage v1.30.1 // indirect
cloud.google.com/go/iam v1.1.5 // indirect
cloud.google.com/go/storage v1.35.1 // indirect
cosmossdk.io/collections v0.4.0 // indirect
cosmossdk.io/depinject v1.0.0-alpha.4 // indirect
cosmossdk.io/x/tx v0.12.0 // indirect
Expand Down Expand Up @@ -87,9 +87,9 @@ require (
github.com/emicklei/dot v1.6.0 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/getsentry/sentry-go v0.25.0 // indirect
github.com/go-kit/kit v0.12.0 // indirect
github.com/go-kit/kit v0.13.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
Expand All @@ -98,16 +98,16 @@ require (
github.com/golang/glog v1.2.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/orderedcode v0.0.1 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.1 // indirect
github.com/google/uuid v1.4.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
github.com/gorilla/handlers v1.5.2 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
Expand Down Expand Up @@ -149,22 +149,23 @@ require (
github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/pelletier/go-toml/v2 v2.1.1 // indirect
github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.17.0 // indirect
github.com/prometheus/client_golang v1.18.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/rs/cors v1.8.3 // indirect
github.com/rs/zerolog v1.31.0 // indirect
github.com/sagikazarmark/locafero v0.3.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/skip-mev/slinky v0.1.0-alpha.0.0.20240113034931-de4a28ffa013 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.10.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
Expand All @@ -176,22 +177,23 @@ require (
go.etcd.io/bbolt v1.3.8 // indirect
go.opencensus.io v0.24.0 // indirect
go.uber.org/multierr v1.10.0 // indirect
golang.org/x/crypto v0.16.0 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/oauth2 v0.12.0 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/oauth2 v0.15.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/term v0.15.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/term v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.143.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20231030173426-d783a09b4405 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 // indirect
google.golang.org/grpc v1.59.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
google.golang.org/api v0.153.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20231211222908-989df2bf70f3 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231211222908-989df2bf70f3 // indirect
google.golang.org/grpc v1.60.1 // indirect
google.golang.org/protobuf v1.32.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 All @@ -215,6 +217,8 @@ replace (
// TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.1

github.com/skip-mev/slinky => github.com/initia-labs/slinky v0.0.0-20240116092207-9fc17d676ce6

// Downgraded to avoid bugs in following commits which caused simulations to fail.
github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
)
Loading

0 comments on commit 44403e7

Please sign in to comment.